-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Allow options.highlight to specify custom classes #54
Comments
This was referenced Aug 9, 2012
+1 |
1 similar comment
+1 |
chjj
added a commit
that referenced
this issue
Jan 10, 2013
Fixed with: 8332826 |
ghost
pushed a commit
to zergeborg/marked
that referenced
this issue
May 13, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using marked together with highlight.js, but there's a bit of snag: highlight.js (and/or its styles) requires the plain name of the language (like
"python"
) as a class on the<code>
tag, but marked uses class names that look like"lang-python"
. I hacked around this in my copy of marked.js by adding the class name -- you can see the change here -- but it'd be nicer if marked let me specify additional/alternative class names.I suggest that
options.highlight()
be allowed (optionally -- use a type check) to return an object that has two properties: the code string (i.e., what is returned now) and an array of class names to be applied. I can certainly code it and submit a pull request, if desired.(For completeness: I could alternatively ask highlight.js to make the class names it expects be configurable. But it's not clear how to do that in any sane way -- the classes are explicit in the CSS. Making the change in marked feels like the correct approach anyway.)
Thanks for the great tool. It was utterly essential in the development of my Markdown-email browser extension.
The text was updated successfully, but these errors were encountered: