Comments (2)
Eleventy has a bunch of Prism-specific loading code to facilitate its use in Node.
I think your best bet here is a programmatic use of this plugin. We do provided a pairedShortcode
export that you can use, e.g.
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const eleventyPrism = syntaxHighlight.pairedShortcode;
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight);
// Code examples shortcode
eleventyConfig.addPairedShortcode("example", function(content, title, show_preview, show_markup) {
return outdent`
<div class="card docs-example">
${title ? `<h6 class="card-header">${title}</h6>` : `<h6 class="card-header">Example</h6>`}
<div class="card-body">
${show_preview ? `<div class="docs-example-content">${content}</div>` : ``}
${show_markup ? `<div class="docs-example-markup">${eleventyPrism(content), "html"}</div>" : ``}
</div><!-- /.card-body -->
</div><!-- /.docs-example -->
`
});
// And so on
}
from eleventy-plugin-syntaxhighlight.
This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.
If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and we will reopen the issue. Thanks!
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.