yuin / goldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.
MIT License
3.68k stars 255 forks source link

lists in footnotes rendered oddly #312

Closed lschierer closed 2 years ago

lschierer commented 2 years ago

goldmark has https://github.com/yuin/goldmark/discussions in github. You should post only issues here. Feature requests and questions should be posted at discussions.

Please answer the following before submitting your issue:

  1. What version of goldmark are you using? : goldmark@0.2.0 as provided by npm
  2. What version of Go are you using? : go version go1.18.3 darwin/arm64
  3. What operating system and processor architecture are you using? : OSX 12.3.1 on an M1
  4. What did you do? : I have the following footnote definition:
    
    [^211020-8]: [Harry Potter Wiki](https://harrypotter.fandom.com/wiki/)
    * "[Amortality](https://harrypotter.fandom.com/wiki/Amortality)
      Last Edited: 2021-09-06. Last Viewed: 2021-10-20.
    * "[Non-Human Spiritous Apparition](https://harrypotter.fandom.com/wiki/Non-Human_Spiritous_Apparition)"
      Last Edited: 2021-10-11. Last Viewed: 2021-10-20.
6. What did you expect to see? : I expected that the unordered list would be at the first level, the same as it would be if I had typed

As footnotes are an extension, I did not check with CommonMark. I not aware of a good way to test this in another renderer with this extension, but happy to do so.

yuin commented 2 years ago

As mentioned in README, goldmark's footnote is an implementation of Markdown Extra.

Please try dingus https://michelf.ca/projects/php-markdown/dingus/

lschierer commented 2 years ago

php markdown extra via dingus tested with the following input:

test text[^some] more text

[^some]: test
    * one
    * two
    * three

produced the following html, which looks correct:

<p>test text<sup id="fnref:some"><a href="#fn:some" class="footnote-ref" role="doc-noteref">1</a></sup> more text</p>

<div class="footnotes" role="doc-endnotes">
<hr />
<ol>

<li id="fn:some" role="doc-endnote">
<p>test
* one
* two
* three&#160;<a href="#fnref:some" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a></p>
</li>

</ol>
</div>

note there is only one level of list in the above output.

lschierer commented 2 years ago

mm. interesting, though that it treated the entire thing as a single list item. which isn't correct, but a different error than goldmark is generating.

lschierer commented 2 years ago

the test text

test text[^some] more text

[^some]: 
    * one
    * two
    * three

produces nearly the same error as goldmark:

<p>test text<sup id="fnref:some"><a href="#fn:some" class="footnote-ref" role="doc-noteref">1</a></sup> more text</p>

<div class="footnotes" role="doc-endnotes">
<hr />
<ol>

<li id="fn:some" role="doc-endnote">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>

<p><a href="#fnref:some" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a></p>
</li>

</ol>
</div>

the difference being that goldmark (correctly) does not actually show an ordered list with a numbered bullet point in the extra wrapping list.

lschierer commented 2 years ago

I see what's happening, it is implementing the footnotes themselves as an ordered list, so the bullets inside are a second order list. Okay, that makes sense. Closing this.