mmarkdown / mmark

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

Wrong rendering of inlined contact references to contacts #183

Closed danielfett closed 1 year ago

danielfett commented 1 year ago

When using inlined references to contacts, mmark eats any text surrounding the inlined contacts when they appear in the first paragraph in a section.

Minimal example:

%%%
title = "Test"

[seriesInfo]
name = "Internet-Draft"
stream = "IETF"
status = "standard"
value = "0"

[[author]]
fullname="Foo Bar"

[[contact]]
fullname="Some Contact"

%%%

.# Abstract

Test

{mainmatter}

# Acknowledgements

We would like to thank [@Some Contact] for absolutely nothing.

Mmark creates this XML for the last section:

<section anchor="acknowledgements"><name>Acknowledgements</name>
<contact fullname="Some Contact"><organization></organization><address><postal><street></street>
</postal></address></contact></section>

The text "We would like to thank" has disappeared.

Adding a paragraph after the section title helps:


# Acknowledgements

Now here are the Acknowledgements:

We would like to thank [@Some Contact] for absolutely nothing.

... correctly renders to ...

<section anchor="acknowledgements"><name>Acknowledgements</name>
<t>Now here are the Acknowledgements:</t>
<t>We would like to thank <contact fullname="Some Contact"><organization></organization><address><postal><street></street>
</postal></address></contact> for absolutely nothing.</t>
</section>
danielfett commented 1 year ago

Maybe this bug was introduced by https://github.com/mmarkdown/mmark/pull/132?

miekg commented 1 year ago

yes, I see. I wonder if #132 is even (fully) needed, as the XML outputted for the contact is identical. I could be that it still renders it differently. Let me check that too.

yes, there is a difference in rendering (in the HTML), but of course it shouldn't consume those chars like it does right now

miekg commented 1 year ago

Can you try: https://github.com/mmarkdown/mmark/pull/184

danielfett commented 1 year ago

Thank you for fixing this so quickly!

miekg commented 1 year ago

Note: Ralf Küsters and Tim W<xml><u format="{lit}">ü</u></xml>rtele xml2rfc 3.16.0 supports unicode in the xml source, so any of these workarounds are not needed, ie using <xml> - wonder if that does what you think it does though

danielfett commented 1 year ago

Ooooh, I didn't see the recent update to xml2rfc. That solves the original problem...

danielfett commented 1 year ago

Thanks, I updated my docker container danielfett/markdown2rfc that we use for the spec.