POC.
-
The original code from [TANIGUCHI Masaya] would hang when using on specific node.js application like Astro (deasync problem)
-
David Jencks's extension works on Antora but it is not directly usable for Asciidoctor. But he pointed out that the converted code block would have nested
<pre>/<code>
section. He also has logic to remove the nested code block. -
Reference Anthony Fu's markdown-it-shiki module on how to use the Synckit worker.
- Double
<pre><code>
blocks.
First code block
<pre class="undefined highlight" id="codecell0">
<code data-lang="yaml">
Then it would have another <pre><code>
block (shiki).
The codes from David Jencks would remove the nested block.
Dane Allen points out that it is a design feature of AsciiDoctor to control the code blocks that is inserted in the conversion. This behavior could be changed by over-ridding the 'format' class of the syntax highlighter. Actually David Jencks had opened a ticket about it
This extension does not use Opal to override the format method.
It just construct back the desired <pre><code>
block (generated by AsciiDoctor.js)
and discard the one created by Shiki.
- This is POC. No code linting and not pushed to npmjs.
This extension is not designed for browser. You must not use this extension without Node.js.
MIT license
I make use of the codes from these MIT projects:
- Copyright (c) 2020 Anthony Fu https://github.com/antfu, Markdown it shiki
- Copyright (c) 2021 David Jencks https://gitlab.com/djencks/antora-shiki
- Copyright (c) 2022 TANIGUCHI Masaya. All rights reserved. https://github.com/tani/asciidoctor-shiki
- Copyright (c) 2022 Patrick Dung