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

turbo-paste, add get option format (feature request) #1

Open
insteps opened this issue Jul 30, 2015 · 2 comments
Open

turbo-paste, add get option format (feature request) #1

insteps opened this issue Jul 30, 2015 · 2 comments

Comments

@insteps
Copy link

insteps commented Jul 30, 2015

Pls have a look,
https://gist.github.com/insteps/70315bcaeb4b28734138

This is just to let know some alternate option available in highlightjs.
I am not still sure if adding highlight2.tpl would be needed.
So not creating a pull request.

I would likely merge highlight2.tpl template to original highlight.tpl.
i.e, without &format= set {{{format}}} is empty.

@clandmeter
Copy link
Member

Yes, i was thinking of adding a specific format option to hl.
Actually I think i prefer hl as it is shorter, and we can use it like hl=sh or hl=lua
I have opened an issue to add the option to allow a empty argument here kernelsauce/turbo#205
This would set the auto mode for highlight.js instead of using a boolean.

A single mustache template for hightlight should be enough. Check https://mustache.github.io/mustache.5.html how to use mustache.

P.S. Why did you use

var body = document.getElementById('body');
codes = body.getElementsByTagName('code');
for (c in codes) { codes[c].className='{{{format}}}'; hljs.highlightBlock(codes[c]); }

when you could simply set the class on the code tag like mentioned here https://highlightjs.org/usage

@insteps
Copy link
Author

insteps commented Jul 30, 2015

yes, true !
was thinkin something else while trying to learn lua ;)

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

2 participants