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

Sourcecode highlighting with highlight.js is broken with Asciidoctor.js (node) in 1.0.4 #162

Closed
dschulten opened this issue Dec 25, 2017 · 4 comments

Comments

@dschulten
Copy link
Contributor

dschulten commented Dec 25, 2017

If the adoc has no option

:source-highlighter: highlight.js

then sourcecode sections in slides will not be highlighted. Either please document that the option is required or make it the default.

Even with the above option highlighting is broken in 1.0.4, this line in document.jade:

#{(node.$attr('source-highlighter') == 'highlight.js') ? "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }," : ""}

resolves to:

{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },

i.e. the revealjsdir placeholder remains unresolved, it should be node_modules/reveal.js. No idea if slim would resolve that properly.

@dschulten dschulten changed the title The highlight.js highlighter is not the default source-highlighter Sourcecode highlighting with highlight.js is broken Dec 25, 2017
@keenJoe
Copy link

keenJoe commented Dec 26, 2017

the two options are required,right?
:source-highlighter: highlight.js
:source-highlighter: coderay
and although I resolved code in document.jade, there is no sourcecode highlight.

@dschulten
Copy link
Contributor Author

dschulten commented Dec 26, 2017

Different result in 1.1.0 when executing with Javascript setup:

  • No :source-highlighter: option in presentation.adoc -> Result is no highlighting; expected result would be that highlight.js is used.
  • With :source-highlighter: highlightjs it works, that is also in line with the naming in plain asciidoc 👍

Clearly a major step forward. Since the readme does not mention that highlightjs has to be enabled explicitly, I had expected highlight.js to be the default highlighter. As long as that is not the case, I'll add a pull request for the readme.

@dschulten
Copy link
Contributor Author

dschulten commented Dec 26, 2017

@keenJoe to patch source code highlighting with highlight.js in 1.0.4 you have to replace the above line in document.jade by:

{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },

That way the condition which checks if source-highlighter is highlight.js does not apply, the block will be written and the revealjsdir placeholder will resolve to node_modules/reveal.js.

In 1.1.0 the problem is solved in the sense that you must define highlightjs (no dot!) as source-highlighter.

@dschulten dschulten changed the title Sourcecode highlighting with highlight.js is broken Sourcecode highlighting with highlight.js is broken in 1.0.4 Dec 26, 2017
@obilodeau obilodeau changed the title Sourcecode highlighting with highlight.js is broken in 1.0.4 Sourcecode highlighting with highlight.js is broken with Asciidoctor.js (node) in 1.0.4 Dec 26, 2017
@obilodeau
Copy link
Member

It probably never worked. Asciidoctor.js / node didn't get very far and didn't have many users.

I'm not going to backport a fix in 1.0.x since there are many other things broken with the jade templates. Thanks for PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants