On Thu Apr 30, 2020 at 11:31 AM BST, Junio C Hamano wrote: > This is "possibly just a bit indented run of up to 6 hashes, either > ending the line by itself or if some text follows, there must be a > SP after the hashes". > > If I had a line that has a hash, HT and then "Hello, world", would > everybody's markdown implementation reject it as a header, because > the whitespace after the run of hashes is not a SP? Good point, Pandoc at least accepts a tab as well as a space there. (Some markdown implementations don't even require the whitespace, so any line starting with #{1,6} would be a heading, but that runs into problems with paragraphs containing a line starting with "#", which is not uncommon.) > Also, allowing only the hashes might be spec-compliant, but how > useful would it be to see just a sequence of 4 hashes without any > text after "@@ -100,5, +100,6 @@" in the diff output? > > Taking all that together, my suspicion is > > "^ {0,3}#{1,6}[ \t]" > > i.e. "possibly slightly indented run of 6 hashes, with a whitespace > to catch the headers with real contents and nothing else" might be > more practically useful. I dunno. Sure, that looks plausible. I don't have a strong opinion on whether it's more useful to be consistent (and show the last heading, even if it doesn't contain any text) or to try as hard as possible to just show "some text", even if it's not the last heading, but two people have now suggested changing it, so I'll submit a v3 with your suggested pattern.