New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: replacing highlight.js #1077

Closed
rstacruz opened this Issue Jun 1, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@rstacruz
Copy link
Contributor

rstacruz commented Jun 1, 2017

In my experience, highlight.js is pretty weak for JavaScript code. Here's how Highlight.js would process some simple code (dotted outline added to span.hljs-* elements):

image

In contrast, here's how it'd be handled by Prism:

image

So some questions:

@rstacruz rstacruz changed the title Question: replacing highlightjs Question: replacing highlight.js Jun 1, 2017

@jquense

This comment has been minimized.

Copy link
Collaborator

jquense commented Jun 1, 2017

Good question, I'm not sure t sure if there is a strong reason to use hljs I also tend to prefer prism

@KyleAMathews

This comment has been minimized.

Copy link
Contributor

KyleAMathews commented Jun 1, 2017

I was an ignorant fool when I picked highlight.js over prism back in the day :-) v1 is now using prismjs e.g. https://www.gatsbyjs.org/docs/packages/gatsby-remark-prismjs/

I'm not sure if we want to replace highlight.js as a default though... as that'd mean a breaking change as people would have to switch out the CSS they're using plus it's possible that highlight.js is better than prismjs in some ways that some people prefer etc. I don't want to do any more breaking changes for 0.x as 1.0 is about ready and I'm conserving my limited resources for perfecting that and helping people move over.

This is one of the big downsides to webpack loaders that transformations are difficult to modularize and what Gatsby v1 for the most part corrects. Now it'd be trivial for someone to write a gatsby-remark-highlightjs plugin (it'd be like 25 lines of code) and swap it in for the prismjs highlighter.

@jbolda jbolda added the v0 label Jun 3, 2017

@rstacruz rstacruz closed this Jun 4, 2017

@davidtheclark

This comment has been minimized.

Copy link

davidtheclark commented Jun 22, 2017

I was an ignorant fool when I picked highlight.js over prism back in the day

@KyleAMathews @rstacruz I'm really curious to hear more about your strong preference here. Is it just that you prefer the JavaScript syntax in Prism? Or are there other reasons? (Curious because I'm trying to pick between these myself, and having a hard time.)

@KyleAMathews

This comment has been minimized.

Copy link
Contributor

KyleAMathews commented Jun 22, 2017

It's not that strong actually :-) but prismjs does seem to have better support for JavaScript, especially JSX so that makes it a pretty strong choice for Gatsby. That being said, someone could easily make a highlight.js plugin for Gatsby as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment