kramdown-asciidoc icon indicating copy to clipboard operation
kramdown-asciidoc copied to clipboard

JS version

Open dohliam opened this issue 7 years ago • 5 comments

I built a quick and dirty Markdown to Asciidoctor converter for one-off documents that can be quickly converted in the browser. It uses a very naive series of regexes to do the conversion rather than trying to do anything fancy (which is actually just enough to cover most of the basic features of Markdown), but it would obviously be better if it were possible to use kramdown-asciidoc as a backend instead. Would it be feasible to do something similar to asciidoctor.js and use Opal for example to turn this into a JS library?

dohliam avatar Jun 01 '18 23:06 dohliam

Yes, conversion to JavaScript is very possible. In fact, I choose to base the converter on Kramdown for exactly that reason. Kramdown is a single, pure Ruby gem, making it very compatible with Opal.

We could either transpile Kramdown (and release it as Kramdown.js), then transpile Kramdown AsciiDoc, or we could just bundle it all into a single distribution.

cc: @Mogztter

(we may have to patch some of the regexp like we do in JavaScript)

I built a quick and dirty Markdown to Asciidoctor converter for one-off documents that can be quickly converted in the browser.

I've made similar efforts in the past. But I soon realized that the only practical way to make a reliable converter is to start with a real Markdown parser. Kramdown is one of the most widely used and well-adopted parsers, plus it has an AST, so it's a perfect starting point.

mojavelinux avatar Jun 07 '18 07:06 mojavelinux

We could either transpile Kramdown (and release it as Kramdown.js), then transpile Kramdown AsciiDoc, or we could just bundle it all into a single distribution.

I think it makes sense to transpile and release Kramdown.js (as this library can be useful).

ggrossetie avatar Jun 07 '18 16:06 ggrossetie

:+1: It could also be a very useful study case for Opal.

mojavelinux avatar Jun 07 '18 17:06 mojavelinux

Now that 1.0.0 is out, it's probably a good time to start exploring transpilation to JavaScript. The tough part is going to be Kramdown. Has anyone given it a shot yet?

mojavelinux avatar Nov 27 '18 10:11 mojavelinux

Any update on this? I want to try & use this with Maven and the only ruby plugin I found is not compatible with JDK11. I am already running your excellent Antora in Maven for this project.

My use case is to include some markdown source files into an Antora site that is automatically built using maven for a Java project.

bwosborne2 avatar Feb 04 '21 12:02 bwosborne2