[gatsby-remark-prismjs] `diff` with language / highlight
See original GitHub issueHi there!
Trying to understand a few things related to gatsby-remark-prismjs
and how it may (or may not) differ from regular prismjs
.
The prism site has an example of diff-highlighting and I’m trying to recreate that in my site (here’s my post).
Github’s preview is a good example of what I’m striving for:
On my site, however, I can’t seem to figure out how to get highlights - whether language specific or not:
I’ve tried
```diff-javascript
```diff javascript
And several other variants, but to no avail.
Interestingly, diff-javascript
results in some weird encoding (note the undefined
values that get appended to the ends of lines):
My questions:
- Does
gatsby-remark-prismjs
support multi-language (diff + javascript for example)? - Does
gatsby-remark-prismjs
support line-highlighting (with the green/red, not the standard highlighting)?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Improving Prism diff syntax highlighting in Gatsby
Tweaking Prism and Gatsby to improve the syntax highlighting of diffs (works on Next.js and other framework too).
Read more >gatsby-remark-prismjs
gatsby -remark-prismjs Adds syntax highlighting to code blocks in markdown files ... blocks by using diff-[language] to enable syntax highlighting in diffs:.
Read more >5 ways to improve your Gatsby code blocks - Emma Goto
Use syntax highlighting with gatsby-remark-prismjs. Syntax highlighting changes the colour of parts of your code to make it more readable. It's ...
Read more >gatsby-remark-prismjs @ 3.2.7 .. 3.2.8 - Package Diff
Visual diff of the npm package 'gatsby-remark-prismjs' comparing 3.2.7 with ... +module.exports = (language, code, lineNumbersHighlight = [] ...
Read more >gatsby-remark-prismjs/README.md - UNPKG
1, # gatsby-remark-prismjs. 2. 3, Adds syntax highlighting to code blocks in markdown files using. 4, [PrismJS](http://prismjs.com/).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh I see — this is coming from a separate, additional plugin.
https://github.com/DSchau/gatsby-remark-code-titles
I checked the code of that plugin just briefly and I don’t think there’s anything that should necessarily change how it works with
gatsby-remark-prismjs
. If it works for you now it should continue to without issue.Feel free to pull down
@jonsully/gatsby-remark-prismjs
(latest version) and give it a try thoughGreetings 👋🏻
This bothered me too, especially since I don’t use the line-highlighting implemented by this plugin. ~I modded a bit of the diff-sniffing code behind this plugin and published a variant (REVOKED) that injects the
diff-highlight
class. I likely won’t PR this repo with the changes because they’re not the cleanest and it sort of goes against Commonmark spec, but you’re welcome to use it if you’d like~:~Give it a try if ya like. Your mileage may vary~
EDIT: Removed the above; this was a bad direction. I’ve since iterated and PR’d this repo with more reasonable and better changes. Instructions for installing until the PR is merged coming soon 👍🏻