Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS version #7

Open
dohliam opened this issue Jun 1, 2018 · 5 comments
Open

JS version #7

dohliam opened this issue Jun 1, 2018 · 5 comments

Comments

@dohliam
Copy link

dohliam commented Jun 1, 2018

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?

@mojavelinux
Copy link
Member

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.

@ggrossetie
Copy link
Member

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

@mojavelinux
Copy link
Member

👍 It could also be a very useful study case for Opal.

@mojavelinux
Copy link
Member

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?

@bwosborne2
Copy link

bwosborne2 commented Feb 4, 2021

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.

osfameron added a commit to osfameron/docs-site that referenced this issue Jun 14, 2022
Block extension to filter text like:

    [markdown]
    --
    Filter some text with [Markdown](https://commonmark.org/help/) syntax.
    --

This is not implemented with a full Markdown parser.
See asciidoctor/kramdown-asciidoc#7
with a link to the "naive series of regexes" used as starting point.

(And note that we use Open structural context
https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/#summary-of-structural-containers
with `--` delimiters, and headings don’t work inside these.)

This feature is intended for handling OpenAPI specs, which can contain Markdown,
however openapi-generator has poor Asciidoc handling
OpenAPITools/openapi-generator#11396
so instead we add the block delimiters in the template, and let the block filter handle it.
osfameron added a commit to osfameron/docs-site that referenced this issue Jul 1, 2022
Block extension to filter text like:

    [markdown]
    --
    Filter some text with [Markdown](https://commonmark.org/help/) syntax.
    --

This is not implemented with a full Markdown parser.
See asciidoctor/kramdown-asciidoc#7
with a link to the "naive series of regexes" used as starting point.

(And note that we use Open structural context
https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/#summary-of-structural-containers
with `--` delimiters, and headings don’t work inside these.)

This feature is intended for handling OpenAPI specs, which can contain Markdown,
however openapi-generator has poor Asciidoc handling
OpenAPITools/openapi-generator#11396
so instead we add the block delimiters in the template, and let the block filter handle it.
Create a block with potentially multiple lines (sub-paragraphs)

* Add extensions doc page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants