metanorma / coradoc

Coradoc is the Core AsciiDoc Parser used by Metanorma
MIT License
1 stars 4 forks source link

Parse Markdown into Coradoc #11

Open ronaldtse opened 1 year ago

ronaldtse commented 1 year ago

Markdown is a lightweight rich-text markup language defined with these syntaxes:

The particular flavors we want to support in Markdown are:

This task is to implement a Markdown parser input to create in a Coradoc::Document that corresponds to the elements in these Markdown flavors.

The parser is to be written using the Parslet gem.

This is sample code:

markdown = IO.read("my_text.md")
# => 
# "# My Title
# my text ..."
doc = Coradoc::Markdown.parse(markdown)
# => Coradoc::Document
doc.to_adoc
# =>
# "= My Title
# my text..."