Custom code highlighter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom code highlighter

Victor Romero
Hello,

I'm wondering if someone has already tried to create a custom code highligher for a DSL using extending any of the four highlighters (CodeRay, Highlight.js, Prettify, Pygments) in a asciidoctor friendly way.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Custom code highlighter

mojavelinux
Administrator
I would recommend just extending CodeRay (the most Ruby friendly approach) in the normal way as described in CodeRay. Then, you just require your library (using -r in the asciidoctor command) and CodeRay should delegate to it. It's out of Asciidoctor's hands at that point. Asciidoctor is just invoking CodeRay and passing it the language.


-Dan

On Tue, Feb 24, 2015 at 10:49 PM, Victor Romero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

I'm wondering if someone has already tried to create a custom code highligher for a DSL using extending any of the four highlighters (CodeRay, Highlight.js, Prettify, Pygments) in a asciidoctor friendly way.

Thanks


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Custom-code-highlighter-tp2799.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Custom code highlighter

mojavelinux
Administrator
In reply to this post by Victor Romero
Of course, you could also do the same for highlight.js. In that case, you'd need to either load a custom version of highlight.js (see https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/converter/html5.rb#L100) or add an additional JavaScript to the output using docinfo.

Cheers,

-Dan

On Thu, Apr 2, 2015 at 12:44 PM, Dan Allen <[hidden email]> wrote:
I would recommend just extending CodeRay (the most Ruby friendly approach) in the normal way as described in CodeRay. Then, you just require your library (using -r in the asciidoctor command) and CodeRay should delegate to it. It's out of Asciidoctor's hands at that point. Asciidoctor is just invoking CodeRay and passing it the language.


-Dan

On Tue, Feb 24, 2015 at 10:49 PM, Victor Romero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

I'm wondering if someone has already tried to create a custom code highligher for a DSL using extending any of the four highlighters (CodeRay, Highlight.js, Prettify, Pygments) in a asciidoctor friendly way.

Thanks


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Custom-code-highlighter-tp2799.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



--