Comments (9)
remark-highlight.js 4.0.1
is out with this fix.
from lowlight.
The weird part is: webpack emit a warning, which actually is an error (modules are skipped...). Maybe you should emit a warning and not fail, as highlight.js does? (Highlight.js silently fail and does not even emit a warning actually)...
I have a website (putaindecode.io) which use a lot console
syntax and I am afraid to update now :D
from lowlight.
Thanks for raising this here @MoOx!
Here’s the code in Highlight.js: L495-L498, here’s the relative code in Lowlight: L349-L355.
By comparing those two, they both throw an error (albeit the Lowlight one is more cryptic, so that should be fixed).
Highlight.js silently fail and does not even emit a warning actually
Could that be the difference between the setup in highlight and lowlight? As in, through Webpack, or remark-highlight.js? From what I read in the code, both should throw an error if the language isn’t available.
How did the previous set-up of remark-highlight handle console
highlighting? Did it ignore the code-block? Maybe the solution is to ignore highlighting blocks with unknown flags, or warn instead of throwing?
from lowlight.
It using remark-highlight.js spawn by a webpack loader :D
I were just using remark-highlight.js which was using highlight.js directly, and I "just" upgraded to the new version using lowlight (btw, great name haha).
Previously this was not throwing any error or warning anywhere, and code block where just not highlighted (even if "rendered", see image below).
Do you need more info?
from lowlight.
btw, great name haha
<3
Previously this was not throwing any error or warning anywhere, and code block where just not highlighted (even if "rendered", see image below).
I think the difference in behaviour is this line in remark-highlight.js
, which switched from highlightAuto
to highlight
. The behaviour of highlightAuto
is to ignore non-existing flags, and that of highlight
is to throw. @ben-eb, any reason you opted to switch this?
from lowlight.
Ah, so that's the culprit! Happy to release a patch changing this, no need for a major right?
from lowlight.
No need for a major indeed. Look like it's just a patch :)
from lowlight.
No major, I doubt people are relying on their highlighting to throw. Only case I can imagine for that is tests, but those tests are testing the wrong thing anyhow and should’ve reporter it here already :)
from lowlight.
Thanks!
from lowlight.
Related Issues (20)
- Is there a way to add the line numbers? HOT 1
- Import the highlight languages asynchronously on demand HOT 2
- missing getLanguage API HOT 5
- `main` branch not compat with remark-highlightjs? HOT 16
- How do you use lowlight with hljs v11 support with cjs/node? HOT 9
- is possible to release with a cjs module? HOT 1
- Use with webpack will throw Uncaught Error: Unknown language: `js` is not registered HOT 2
- How to resolve TypeScript conflict errors? HOT 1
- re-export highligh.js `getLanguage` HOT 3
- Handle subscopes differently/better? HOT 14
- Tiny private API change HOT 2
- Error: Must use import to load ES Module HOT 1
- How can we change the entry point from lib/common.js to lib/all.js HOT 1
- Running highlight.js after using lowlight results in blank output from highlight.js HOT 12
- Incorrect Solidity hightlighting with certain comments HOT 3
- Add position information to tokens HOT 5
- Compatible with ES6 browsers HOT 1
- Convert tree to LaTeX? HOT 1
- Class for nested languages correct? HOT 8
- What is devlop? HOT 3
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 lowlight.