MD041: errors when using html's `h1` instead of `#` in most cases
See original GitHub issueWith the rule MD041 (first-line-heading) enabled:
- no error using
#
-
simple code:
# title test test ## test level 2
rendered:
title
test test
test level 2
-
image as title code:
# ![](https://via.placeholder.com/200x100) test test ## test level 2
rendered:
test test
test level 2
-
centered image as title using
p
andimg
code:# <p align="center"><img src="https://via.placeholder.com/200x100"></p> test test ## test level 2
rendered (note: this renders differently in github readmes than comments; the heading line below the image here is above the image in readmes (which is not what we want in general)):
test test
test level 2
-
centered image as title using
h1
andimg
(this has two level-1 headings in one line and also (correctly) renders two heading lines, both is not nice) code:# <h1 align="center"><img src="https://via.placeholder.com/200x100"></h1> test test ## test level 2
rendered:
test test
test level 2
-
- no error using h1
- it’s okay with
h1
stuff as long as something with#
comes after it code:
rendered:<h1>title</h1> # title test test ## test level 2
title
# titletest test
test level 2
- it’s okay with
- error using h1
-
simple code:
<h1>title</h1> test test ## test level 2
rendered:
title
test test
test level 2
-
image as title code:
<h1><img src="https://via.placeholder.com/200x100"></h1> test test ## test level 2
rendered:
test test
test level 2
-
While I know that using h1
instead of #
is not “pure” and that using images as titles is kinda weird, both are often seen in GitHub readme files for a reason. The first one because you can’t center #
, but you can center h1
(<h1 align="center">title</h1>
). The second one because the first image (or even the first “thing”) in a readme often is the logo, which includes the project name most of the time, so it feels kinda redundant to have the name of your project above the logo of your project which includes the name of your project again.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I kind of feel like this is an abuse of Markdown, but it may be straightforward to add and I’ll have a look.
Yes