Comments (5)
P.S. Currently I'm getting around this using the syntax:
pre(class='language-coffeescript')
code(class='language-coffeescript').
foo = (bar) ->
# etc...
from metalsmith-prism.
metalsmith-prism is just a wrapper around Prism.js I believe it only works with the <code>
tag.
I'm not sure why the highlighting isn't properly formatted without <pre>
tag but when I have a minute I'll take a peek.
from metalsmith-prism.
Well I did a quick hack to lib/index.js and changed it to $(options.tagName || 'code')
and I'm able to highlight anything.
I can submit a PR, I just didn't know if the maintainer had a preferred way to do this. I figured I'd open a discussion about it prior to making any modifications.
from metalsmith-prism.
Seems simple enough. In the PR:
- include unit test
- update the README options section
I can cut a release today as soon as everything passes.
from metalsmith-prism.
It looks like Prism automatically adds the appropriate language class prism.js#L731 to the <pre>
parent but only when the function fileHighlight() is run on DOMContentLoaded...which is never trigged with this plugin.
Would adding that same behavior into this plugin satisfy your request? I'm trying to stay as close to the Prism.js concepts as much as possible.
Prism does its best to encourage good authoring practices. Therefore, it only works with
<code>
elements, since marking up code without a<code>
element is semantically invalid.
from metalsmith-prism.
Related Issues (10)
- Tell everyone about metalsmith-prism in the metalsmith.io site HOT 3
- sunset support for node 10.x
- self not defined lint error in 2.0.0 HOT 2
- switch to ESLint
- Make HTML decode configurable HOT 6
- Having trouble getting to work with Markdown code HOT 2
- Failed to load prism syntax: scala
- No styles applied HOT 6
- Upgrade to Node 8 breaks plugin HOT 6
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 metalsmith-prism.