metanorma / coradoc

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

reverse_adoc: Headings: generate titles compatible with AsciiDoctor #79

Closed hmdne closed 1 month ago

hmdne commented 4 months ago

@hmdne we want to be compatible with Asciidoctor, so h6 goes to 6 equal signs and vice versa. Thanks.

Originally posted by @ronaldtse in https://github.com/metanorma/coradoc/issues/76#issuecomment-2141919338

The task is to make it so for example <h3> will generate an output of === and not ==== as it does currently.

The problem that I see, is that = is not a section title. Currently it's generated from a <title> tag. A document can only have one = tag if it's an article.

ronaldtse commented 4 months ago

So this is where we have to differ.

Our conversion target is actually Metanorma. It happens that Metanorma mostly uses Asciidoctor for parsing.

In Metanorma AsciiDoc,

So when I meant Asciidoctor compatible, I really meant Metanorma compatible.

hmdne commented 4 months ago

Note, that this issue is about conversion from HTML, so we are talking about <h1> tags, etc.

As of now, <hX> tag generates a section with title of level X ("=" * (X+1)). This issue is about changing the behavior and generating a section with title of level X-1 ("=" * X). If that's not the intended behavior, feel free to close the issue.

Do note that closing this issue will still keep us with the behavior of a roundtrip: adoc --[asciidoctor]--> html --[coradoc]--> adoc that makes the clauses go up one level.