gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 274 forks source link

Possibly erroneous warning by the parser for the generated markdown? #766

Closed rubyFeedback closed 1 week ago

rubyFeedback commented 2 years ago

I got this error message recently:

Warning: Found invalidly used HTML closing tag for 'b' on line 1866

I opened that file via vim and +1866 which I think jumps to the line.

The line at hand was:

The file <b>examples/complex/016_grid_example.rb</b> shows
this new API, mixed with the old, original API.

This is documentation for one of my gems. I use a README.gen file to generate a README.md, using some scripts and macros.

I believe the line should work though. Not sure why kramdown complains.

kramdown version is using: 2.4.0

Anyway, could you add the above to a test for kramdown perhaps? Perhaps I made a mistake, but either way I'll report it here.

I am receiving some warnings in other projects. At some later point I may give you a more thorough analysis of the warnings kramdown generates - which is super-useful but sometimes confusing too. Perhaps kramdown could also show some more information or so, a bit like the did-you-mean gem.

gettalong commented 2 years ago

I can confirm that the warning is issued and that it is wrongly issued.

The reason for this is that the <b> gets parsed and put onto the parse stack. When the _grid_ part is seen, the parser thinks it is an emphasis and tries to parse it, then comes across the </b> which it thinks is invalid (and would be so if the emphasis was correct). When it later determines that the emphasis is invalid, parsing continues at the grid_ part and later the </b> is found and correctly used.

Will need to think about how to tackle this.

gettalong commented 1 week ago

I have fixed this.