Embed syntax highlight css

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

Embed syntax highlight css

klchk
Hi

I am writing my API doc, using Maven asciidoc plugin. This document have different HTTP sections involving request and response.

Now I want to highlight the syntax (eg JSON inside it), using highlight.js I get the result i want but there's a problem - the css of highlight.js is not embedded with the html itself. Instead, the highlight folder is copied to output directory

Default style of all highlighter are not the style I want, is there a way to make css embedded?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Embed syntax highlight css

mojavelinux
Administrator
I'm glad to hear you are using Asciidoctor for writing your API docs.

Assuming you are generating a standalone HTML document, the JavaScript and CSS for highlight.js is linked from a CDN by default. The built-in HTML converter does not currently support embedding these assets directly into the HTML. If you want that behavior, you can implement a custom converter or a custom document HTML template.

Of course, that's assuming you are generating a standalone HTML document. If you are generating embeddable HTML, then Asciidoctor only outputs the contents of the body element. It's up to you or the tool calling Asciidoctor to put that into an HTML template that has the highlight.js assets.

Cheers,

-Dan

On Mon, Sep 12, 2016 at 10:48 PM, klchk [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi

I am writing my API doc, using Asciidoctor of course. That have different HTTP sections involving request and response.

Now I want to highlight the syntax (eg JSON inside it), using highlight.js I can do it. But I found one problem - the css of highlight.js is not embedded with the html itself.

Is there a way to make it embedded?

Thank you!


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



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux