Skip to content

patrickdung/asciidoctor-shiki-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asciidoctor Syntax Highlight Extension for Node.js

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.

Problems

  1. 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.

  1. This is POC. No code linting and not pushed to npmjs.

Usage

This extension is not designed for browser. You must not use this extension without Node.js.

Copyright and License

MIT license

I make use of the codes from these MIT projects:

About

Asciidoctor shiki extension, POC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published