mmarkdown / mmark

Mmark: a powerful markdown processor in Go geared towards the IETF
https://mmark.miek.nl
Other
480 stars 45 forks source link

truly "compact" lists in new v3 RFC HTML #105

Closed b---c closed 4 years ago

b---c commented 4 years ago

Lots of details follow but in summary I think my question is this: is there some directive or markdown or formatting trick that would result in the <t> elements being omitted from the various list <dd> and <li> items in the XML produced from mmark? Or is there a bug or feature request in here somewhere? Or is this an unavoidable loss of fidelity as conversion happens between a myriad of formats? Or perhaps I'm way off in the weeds with this whole thing... ?

Using mmark 2.2.3 with no CLI options on Mac to produce the XML for an IETF WG document, which is here: https://github.com/oauthstuff/draft-oauth-par and specifially I ran into this trying to make the IANA section look tidy https://www.ietf.org/id/draft-ietf-oauth-par-01.html#name-iana-considerations by grouping the definition list closer together.

I would sometimes like to use compact lists (<dl>,<ol> and <ul> with the spacing="compact" attribute) in IETF drafts 'cause I think they just look better in certain curemstances.

Using {spacing="compact"} in the markdown does result in the spacing="compact" attribute in the XML element as expected. And this produces the desired outcome in the text format out of xml2rfc (2.40.0). The HTML out of xml2rfc has compact added to the class of the <ol> and dlCompact to class of the <dl>. But curiously does nothing different on the <ul>, which is perhaps an issue with xml2rfc. Visually the class="compact" on the <ol> does seem to compress things a little bit but otherwise the spacing="compact" appears to have no ultimate effect on the HTML.

All of the content of the <dd> and <li> elements in the XML out of mmark are wrapped in a <t> and that in turn results in the content being inside<p> elements in xml2rfc's HTML. Those <p> elements on each item result in extra space between items and lists that don't look very compact at all.

Here's a screen shot of the rendered HTML without the {spacing="compact"} in the original markdown: Screen Shot 2020-02-19 at 1 06 51 PM

Here's a screen shot of the rendered HTML with the {spacing="compact"} in the original markdown: Screen Shot 2020-02-19 at 1 07 00 PM

Here's a markdown snippet I've been using to testing (with and without the three {spacing="compact"}):

Unordered:  

{spacing="compact"}
+ something
+ something else
+ another thing

Ordered:

{spacing="compact"}
1. one
1. two
1. three

Definition:

{spacing="compact"}
one:
: uno

two:
: dos

three:
: tres

Removing the seemingly extraneous <t> elements from the XML produced by mmark and running that though xml2rfc gives more compact lists: Screen Shot 2020-02-19 at 1 14 23 PM

Although it also somewhat compacts normal lists too: Screen Shot 2020-02-19 at 1 14 35 PM

miekg commented 4 years ago

[ Quoting notifications@github.com in "[mmarkdown/mmark] truly "compact" l..." ]

Lots of details follow but in summary I think my question is this: is there some directive or markdown or formatting trick that would result in the <t> elements being omitted from the various list <dd> and <li> items in the XML produced from mmark? Or is there a bug or feature request in here somewhere? Or is this an unavoidable loss of fidelity as conversion happens between a myriad of formats? Or perhaps I'm way off in the weeds with this whole thing... ?

Hmm, I see that https://tools.ietf.org/html/rfc7991#section-2.29 indeed allows this, the intent being that if there isn't any block level elements you don't need to insert - mmark should be able to tell from the AST if there are such elements and then suppress the

-elements.
b---c commented 4 years ago

Thanks for the quick response!