Comments (4)
Describe the issue
Integer literals in C++ may be written as 1'000'000'000 instead of 1000000000 for greater readability. When this is used inside a
#define
, if breaks highlighting which treats the rest of the code as being inside a string.Which language seems to have the issue?
cpp
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce
#include <iostream> #define INF 1'000'000'000 int main() { int a = INF; return 0; }
Expected behavior
The token 1'000'000'000 should be highlighted as a number, and the following code should also be highlighted normally, instead of as if it is inside a string:
Additional context
The snippet below seems to be highlighted fine, so the issue is likely the interplay between quote-separated literals and defines.
#include <iostream> int f(int x) { return f(2'000); } int main() { int a = 1'000'000'000; int b = f(1'000); return null; }
from highlight.js.
Describe the issue
Integer literals in C++ may be written as 1'000'000'000 instead of 1000000000 for greater readability. When this is used inside a
#define
, if breaks highlighting which treats the rest of the code as being inside a string.Which language seems to have the issue?
cpp
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce
#include <iostream> #define INF 1'000'000'000 int main() { int a = INF; return 0; }
Expected behavior
The token 1'000'000'000 should be highlighted as a number, and the following code should also be highlighted normally, instead of as if it is inside a string:
Additional context
The snippet below seems to be highlighted fine, so the issue is likely the interplay between quote-separated literals and defines.
#include <iostream> int f(int x) { return f(2'000); } int main() { int a = 1'000'000'000; int b = f(1'000); return null; }
from highlight.js.
Can you confirm a fix: #3930
from highlight.js.
Looks great, thanks!
Before:
After:
from highlight.js.
Related Issues (20)
- Highlight.js removing line breaks from core/code block after update HOT 3
- nginx is missing in the CDN build though documented under "common" HOT 5
- Time to finally allow negative lookbehind? HOT 1
- (YAML) keys containing brackets highlighted wrongly HOT 1
- (Python) unhighlighting the function calling HOT 1
- [Request] Ignoring parts within specific delimiters HOT 1
- (request org repo) highlightjs-codeowners HOT 3
- Linting error for all pull request automated testing HOT 1
- When the highlight code text is too large, it can cause the browser to lag and even crash HOT 8
- False positives for comments in bash
- Cannot install @highlightjs/cdn-assets using npm HOT 3
- (JavaScript) Number in class or variable name breaks highlight HOT 6
- (request org repo) highlightjs-luau HOT 1
- (rust) raw keyword variable names are not highlighted correctly HOT 3
- (rust) quotes around a char emoji are not colored properly HOT 3
- (perl) "@" breaks highlighting HOT 2
- typescript type mismatch
- Add a way to get a language given an alias HOT 5
- MiniProgramError SyntaxError: Invalid regular expression: /[\p{L}_]/: Invalid property name in character class HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highlight.js.