Skip to content
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

Closed
adam-p opened this issue Jun 10, 2012 · 3 comments
Closed

Allow options.highlight to specify custom classes #54

adam-p opened this issue Jun 10, 2012 · 3 comments

Comments

@adam-p
Copy link

adam-p commented Jun 10, 2012

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.

@ghost
Copy link

ghost commented Aug 24, 2012

+1

1 similar comment
@pronebird
Copy link

+1

chjj added a commit that referenced this issue Jan 10, 2013
@chjj
Copy link
Member

chjj commented Jan 10, 2013

Fixed with: 8332826

@chjj chjj closed this as completed Jan 10, 2013
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants