cabo / kramdown-rfc

An XML2RFC (RFC799x) backend for Thomas Leitner's kramdown markdown parser
MIT License
194 stars 82 forks source link

Using same text as section name in a link causes it to be removed #210

Closed CxRes closed 12 months ago

CxRes commented 12 months ago

Using same text as section name in a link causes the text to be removed in the XML. It then gets replaced by "Section X" in the HTML.

Input

# Foo {#foo}

[Hi](#foo) There!

[foo](#foo)bar?  // I want the section name in lowercase, hence not using {{<<foo}}.

Output

<section anchor="foo"><name>Foo</name>

<t><xref target="foo">Hi</xref> There!</t>

<t><xref target="foo"></xref>bar?</t>

Output HTML

<section id="section-1">
      <h2 id="name-foo">
<a href="#section-1" class="section-number selfRef">1. </a><a href="#name-foo" class="section-name selfRef">Foo</a>
      </h2>
<p id="section-1-1"><span><a href="#foo" class="internal xref">Hi</a> (<a href="#foo" class="auto internal xref">Section 1</a>)</span> There!<a href="#section-1-1" class="pilcrow">¶</a></p>
<p id="section-1-2"><a href="#foo" class="auto internal xref">Section 1</a>bar?<a href="#section-1-2" class="pilcrow">¶</a></p>
</section>
cabo commented 12 months ago

This is actually a feature. It is too late in the day for me to remember why this feature exists. (In any case, we couldn't change this as tons of documents rely on this feature.) Workaround: Cheat with a zero width space...

CxRes commented 12 months ago

Thanks for clarifying! I'll cheat ;)