Giter VIP home page Giter VIP logo

Comments (9)

ben-eb avatar ben-eb commented on May 13, 2024 1

remark-highlight.js 4.0.1 is out with this fix.

from lowlight.

MoOx avatar MoOx commented on May 13, 2024

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.

wooorm avatar wooorm commented on May 13, 2024

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.

MoOx avatar MoOx commented on May 13, 2024

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).

screen shot 2016-08-19 at 12 01 58

Do you need more info?

from lowlight.

wooorm avatar wooorm commented on May 13, 2024

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.

ben-eb avatar ben-eb commented on May 13, 2024

Ah, so that's the culprit! Happy to release a patch changing this, no need for a major right?

from lowlight.

MoOx avatar MoOx commented on May 13, 2024

No need for a major indeed. Look like it's just a patch :)

from lowlight.

wooorm avatar wooorm commented on May 13, 2024

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.

MoOx avatar MoOx commented on May 13, 2024

Thanks!

from lowlight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.