atom-asciidoc-preview
atom-asciidoc-preview copied to clipboard
No preview due to broken syntax highlighting
Description
Generating the preview is broken for certain language specifiers. Curiously it works for some but not for all. It might be related to these issues https://github.com/asciidoctor/asciidoctor.js/issues/715 and https://github.com/asciidoctor/asciidoctor.js/issues/716, which were fixed lately. Unfortunately there wasn't an update to the atom previewer.
- Atom version: 1.36.0 x64 (Elecron:4.1.4,Chrome:69.0.3497.128,Node:v10.11.0)
- OS: linux, Arch
asciidoc-previewversion: 2.12.3language-asciidocversion: 1.11.0
Screenshots
Broken:

Working:

Syntax example
// does not work
= Title
== Installation
.Something
[source, bash]
// ruby, perl etc. doesn't work either
----
ls -la
----
// works
= Title
== Installation
.Something
[source, console]
----
ls -la
----
Hello @marcelhuberfoo, could you please open the developer pane and check the console ? You should see an error message when the document is not rendered.
To open the Developer Tools press Ctrl+Shift+I.
The Atom extension is using a client side syntax highlighting based on https://www.npmjs.com/package/highlights (the internal syntax highlighter used in Atom).
Hi @Mogztter I was wondering if I could open a log console or whatever but didn't think about the dev console... Here you go, hope it helps tracking down the cause.
highlights.coffee? [sm]:44 Uncaught (in promise) TypeError: grammar.tokenizeLines is not a function
at highlightSync (highlights.coffee? [sm]:33)
at tokenizeCodeBlocks (renderer.coffee? [sm]:125)
at renderer.coffee? [sm]:13
at process._tickCallback (internal/process/next_tick.js:68)
highlightSync @ highlights.coffee? [sm]:44
tokenizeCodeBlocks @ renderer.coffee? [sm]:145
(anonymous) @ renderer.coffee? [sm]:23
_tickCallback @ internal/process/next_tick.js:68
The source line at highlights.coffee:44 is:
lineTokens = grammar.tokenizeLines fileContents
Thank you.
I think it's related to: https://github.com/asciidoctor/atom-asciidoc-preview/issues/279#issuecomment-434883201 Please uncheck the "Tree Sitter Parsers" option in core settings.
Yep, that solves my preview problem. Sorry, didn't see that comment before.
It's OK, I think we should add a clear mention somewhere in the README because currently there's an incompatibility with the Tree Sitter grammars (and this issue happens frequently).
Can we close this issue ?
The mentioning sounds good to me. Yes, from my point you can close the issue. Thank you again for your time and help.