-
-
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
'class' attribute value in preAttributes and codeAttributes doesn't work #52
Comments
@zachleat I'd be happy to start working on this, but first it'd be awesome to get your input, so I'd be on the right path ✨ |
How about a function like: eleventyConfig.addPlugin(pluginSyntaxHighlight, {
wrap: inner => `<div class="a-custom-wrapper">${inner}</div>`
}); This is flexible, can be as simple or complex as you like, and would not complicate the plugin |
This was included as an addendum to #50. If you supply a |
@zachleat Out of curiosity, is there a way to preserve the default class name and append the custom class name? If I migrate back to this plugin in the future, I'd have a use case for this: contextual styling for a particular language but also some custom utility classes. Edit: oh, you beat me to it: #66 (comment) |
No but it's easy enough to add it back in with the provided callback! The language is passed to the callback |
Description
When a user adds a
class
attribute value to preAttributes or codeAttributes, nothing happens:Resulting DOM:
I assume this is because
<pre>
and<code>
already have a class name that denotes the language being used (e.g.language-js
).Possible solutions
<pre>
, because the scenario (at least in my case) is to add some layout styling to the code block (say,max-width
):The text was updated successfully, but these errors were encountered: