Comments (6)
Starting with now-available v3.2.1 of this plugin, you can use diff-
on the prefix of your language and Eleventy will use the official Prism.js diff-highlight plugin. Look to https://www.11ty.dev/docs/plugins/syntaxhighlight/ soon for the official docs on this.
from eleventy-plugin-syntaxhighlight.
See #46
from eleventy-plugin-syntaxhighlight.
@peterjcaulfield Right, I'm aware of that manual syntax, but that's different, and very hard to maintain for complex diffs. Whereas real diff syntax support can be applied to unifieddiffs copied from Git.
from eleventy-plugin-syntaxhighlight.
Yep gotcha. It seems like there are issues with a number of Prism plugins when used in a Node env.
from eleventy-plugin-syntaxhighlight.
Amazing, thanks!
from eleventy-plugin-syntaxhighlight.
With the following in my .md
file
```diff-js
function test(a) {
+ const b = a + 1;
const anotherThingThatIWantToBeHighlighted = 'nope';
- return b;
}
```
I end up with this (only the +/- lines have been tokenized). Should this work now and/or am I missing something?
edit: on further inspection, I think it looks like tokenization will work throughout the block (even for unchanged lines) as long as the first line begins with a +
or a -
. Is this a known limitation?
edit some more: think I'm talking nonsense – seems like the amount of indentation is important, and I hadn't indented certain lines by the right amount. Please ignore me
from eleventy-plugin-syntaxhighlight.
Related Issues (20)
- Added and removed lines get no special styling HOT 1
- Providing a default language for fenced code blocks HOT 8
- Add prismjs alias for `nunjucks` mapped to `jinja2` HOT 2
- Unsupported Languages cause Build Failures HOT 3
- Inline code support HOT 1
- Compatibility with markdown-it-attrs HOT 1
- Upgrade to use Torchlight? HOT 6
- Using the diff function, output is not escaped. HOT 3
- Cannot mix `diff` and `diff-lang` in one app HOT 1
- Feature request: config to add wrapping div HOT 2
- Syntax highlighting can fail if another plugin uses Prism too
- diff-javascript code block generates invalid HTML HOT 1
- Remove character wrap feature.
- Change default `lineSeparator` option to `\n` instead of `<br>` HOT 1
- possibility of adding plugins
- possibility of adding plugins
- possibility of adding Prismjs plugins to a config
- possibility of adding Prismjs plugins to a config
- [Discussion] Allowing users to override Prism instance
- If I'm using Ghost as a data source and it provides article content in HTML code, how can I do code highlighting?
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 eleventy-plugin-syntaxhighlight.