gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.36k stars 171 forks source link

Do not include fenced code block in the list #264

Closed AlexandarNaydenovSAP closed 1 year ago

AlexandarNaydenovSAP commented 1 year ago

Issue: https://github.com/gomarkdown/markdown/issues/261

AlexandarNaydenovSAP commented 1 year ago

@kjk Hi, can you check this PR, when you have time?

kjk commented 1 year ago

Looks reasonable, thanks.

Note that might revert it if causes issues elsewhere.

miekg commented 1 year ago

[ Quoting @.***> in "Re: [gomarkdown/markdown] Do not in..." ]

Looks reasonable, thanks.

Note that might revert it if causes issues elsewhere.

I do get a failure in mmark when upgrading to latest go-markdown:

--- FAIL: TestRFC3 (5.85s) --- FAIL: TestRFC3/rfc3/8341 (1.38s) rfc_test.go:44: failed to parse XML3 output for "rfc/8341.md": exit status 1 x.xml(861): Error: Expecting an element , got nothing, at /rfc/middle/section[3]/section[4]/section[4]/dl /home/miek/src/github.com/mmarkdown/mmark/x.xml(1): Error: Invalid document before running preptool. Unable to complete processing x.xml

FAIL

reverting the upgrade makes this not fail. Hope to pin it down, but this hints at a codeblock in a description list.

kjk commented 1 year ago

reverted

@miekg could you add the failing test?

miekg commented 1 year ago

this markdown gets translated differently:

If

error-tag:

:   access-denied

error-path:

:   Identifies the requested protocol operation. The following example represents the <edit-config>
    protocol operation in the NETCONF base namespace:

~~~
 <error-path
    xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
        /nc:rpc/nc:edit-config
 </error-path>
~~~

If a datastore

With master I get xml

<t>If</t>

<dl>
<dt>error-tag:</dt>
<dd><t>access-denied</t>
</dd>
<dt>error-path:</dt>
<dd><t>Identifies the requested protocol operation. The following example represents the &lt;edit-config&gt;
protocol operation in the NETCONF base namespace:</t>
</dd>
</dl>

<artwork> &lt;error-path
    xmlns:nc=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&gt;
        /nc:rpc/nc:edit-config
 &lt;/error-path&gt;
</artwork>
<t>If a datastore</t>

with the 6e commit I get:

<t>If</t>

<dl>
<dt>error-tag:</dt>
<dd><t>access-denied</t>
</dd>
<dt>error-path:</dt>
<dd><t>Identifies the requested protocol operation. The following example represents the &lt;edit-config&gt;
protocol operation in the NETCONF base namespace:</t>
</dd>
<dt></dt>
</dl>

<artwork> &lt;error-path
    xmlns:nc=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&gt;
        /nc:rpc/nc:edit-config
 &lt;/error-path&gt;
</artwork>
<t>If a datastore</t>

Note the extra <dt></dt> that I get in the incorrect case... Now this may be a bug in mmark, but it's def. trigger by this commit.

miekg commented 1 year ago

[ Quoting @.***> in "Re: [gomarkdown/markdown] Do not in..." ]

It could be a bug, but why do you expected to have extra empty

it's mandatory for the XML I'm generating, but never looked in detail for these specific documents. The only thing I see happening is after this is applied it breaks the generated XML.

/Miek

-- Miek Gieben