-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Provide a | highlight
filter as well?
#15
Comments
I'd love this, too. I'm using a CMS as source for my blogposts and it delivers pre-rendered HTML where code is embedded. <pre class="language-css"><code>[...]</code><pre> I hope I haven't overlooked anything, but I'd like to do something like |
Just ran into this problem! This would be super helpful indeed. |
You can DIY this with something like: const { pairedShortcode } = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = function(eleventyConfig) {
eleventyConfig.addFilter("highlight", function(content, language) {
return pairedShortcode(content, language);
});
}; |
@zachleat I don't think that quite solves the initial issue here - which is that only some of the |
Just wanted to check-in on this and see if anyone has found a good solution? Running into this same problem. |
Even though I didn't take a closer look at this plugin, IMO it should be possible to do this. I personally switched away to using shiki as a highlighter and wrote a short blogpost on how to do it: The code from the TLDR should be possible to adapt to also allow for a highlight filter too. |
The paired shortcode is great when I know that an entire block rendered in my template will be code - but sometimes I'm rendering arbitrary markdown that might have code blocks nested inside. In that case, I'd love to do something like:
For now, I'll try importing prism as a stand-alone in addition to
eleventy-plugin-syntaxhighlight
- and use it to generate a custom filter (or tag along on my markdown filter).The text was updated successfully, but these errors were encountered: