marky-markdown icon indicating copy to clipboard operation
marky-markdown copied to clipboard

<h1 align="center"> causes duplicated headings

Open KaelWD opened this issue 7 years ago • 4 comments

Looking at Vuetify's readme I noticed some duplicated headings that are different on github.

The basic HTML that reproduces this is

<h3 align="center">Patrons</h3>

<h4 align="center">Diamond</h4>

<h4 align="center">Palladium</h4>

<h2>Introduction</h2>

Which should come out intact but is instead turned into

<h2><a id="user-content-introduction" class="anchor" href="#introduction" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introduction</h2>
<h2><a id="user-content-introduction-1" class="anchor" href="#introduction-1" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introduction</h2>
<h2><a id="user-content-introduction-2" class="anchor" href="#introduction-2" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introduction</h2>
<h2><a id="user-content-introduction-3" class="anchor" href="#introduction-3" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introduction</h2>

Putting a space inside the last <h2> so it looks like <h2 > results in the correct headings and text, but removes the alignment.

KaelWD avatar Nov 15 '17 15:11 KaelWD

Hi @KaelWD thanks for letting us know!

What on earth ...??? Well this is embarrassing, I must say 😕

I only had time to verify the bug right now, but not look at the code for what might be causing it. At first glance, it looks like we're probably doing something silly in a plugin that deals with what markdown-it parses into html_block tokens.

We'll track it down. Thanks again! ✨ ✨ ✨

revin avatar Nov 15 '17 15:11 revin

Hi @revin, has there been any updates on this?

Francois-Esquire avatar Dec 26 '19 16:12 Francois-Esquire

I've recently reported what appeared to be a bug to NPM and this issue was referenced, so I'll leave a bit of info here.

We're running into an issue where 2 headings are randomly being replaced with "Hello world!" (yeah sounds crazy haha). You can see it on this package's detail page:

image

Meanwhile on GitHub (and in the markdown file of course) the actual content is:

image

On the initial readme when we just had the first header it "worked" (viewable here):

image

Maybe thanks to this we can find the culprit that breaks it?

Edit: The "initial" version mentioned last was actually a h1 with align center, but NPM forces h1 to left align so we changed it to h2. I'm only mentioning this because the title of this issue references h1, when it appears to be occurring with any heading size.

breadadams avatar May 07 '20 20:05 breadadams

at present, this issue has not been solved... 😔

glitchboyl avatar Nov 04 '20 07:11 glitchboyl