Simplistic filtering of headings in comment body
dgw opened this issue · 3 comments
dgw commented
This code is a bit too simplistic:
It doesn't allow for one-line comments that start with an issue/PR/discussion reference, like this one I just left in Sopel's main repo.
Exirel commented
I think and not all(l == '#' for l in line)
should do the trick.
dgw commented
Might want to think again. Markdown headings, like what we use in the issue templates for Sopel itself, are:
# Heading 1
## Heading 2
### Heading 3
And so on.
The whole line won't be just #
characters. But it could work to check if line.split(' ', maxsplit=1)[0]
is all #
s, since Markdown headings are required to have a space between the #
and the heading text.
Exirel commented
Ha! Indeed, I was thinking about rst heading. Maybe it's time for a regex then? Something like re.match(r'#+\s+.')
maybe?