metanorma / coradoc

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

Update Coradoc API for developers (not only reading from files) #134

Open ronaldtse opened 2 months ago

ronaldtse commented 2 months ago

The current approach of Coradoc::Converter.convert is unusable by developers:

Coradoc::Converter.convert("input.html", "output.adoc", input_processor: :html, output_processor: :adoc)

Many users have a particular need to convert actual content and use it in Ruby:

# Parsing HTML into a Coradoc tree
cdoc = Coradoc::Input::Html.parse(html_string)
# Generating AsciiDoc from the Coradoc object
cdoc.to_adoc

This allows us to do things like this in the future:

# To Markdown
cdoc.to_md