atom-asciidoc-preview
atom-asciidoc-preview copied to clipboard
Don't allow source-highlighter to crash Asciidoctor.js
The source-highlighter attribute should be overridden to prevent Asciidoctor.js from crashing. We should probably just set it to highlight.js
explicitly, perhaps with an option in the settings page to disable this feature. We don't want the preview to crash if the value is set to pygments
in the document, for instance.
I can the default attributes to
default: 'platform=opal platform-opal env=browser env-browser source-highlighter=highlight.js'
It should be enough, right ?
For now, I think that's sufficient.
The correct long-term solution is to do what docgist is doing, which is to parse the document header of AsciiDoc and make a smart decision about which source-highlighter
value to pass to the processor when running convert
. See https://github.com/asciidoctor/docgist/blob/master/js/docgist.js#L40-L64. This way, you have lots of control over the value.
For the short-term, forcing source-highlighter=highlight.js
does solve the issue with crashing.
The downside of the long-term solution is that it does slightly slow down rendering because you visit all the lines twice. However, that's something we'll eventually address in core, so it's not something we should program around.
Ok, i have add :
source-highlighter=highlight.js
I keep this issue open as long as a better solution is not implemented