Re: [PATCH] userdiff: support Markdown
- From
Ash Holland <ash@sorrel.sh>
- Date
- Apr 29, 2020, 12:21 UTC
- Message-ID
- <C2DOR3QPGHWC.2H494OQI75ZRW@what>
- In-Reply-To
- <91ff4bdb-9b53-8fd1-6282-ac19a9caf1d8@kdbg.org>
On Fri Apr 24, 2020 at 8:21 PM BST, Johannes Sixt wrote:
Show 25 quoted lines
> Am 24.04.20 um 01:42 schrieb Ash Holland:
> > On Thu Apr 23, 2020 at 9:17 PM PST, Johannes Sixt wrote:
> >> Am 21.04.20 um 03:00 schrieb Ash Holland:
> >>> diff --git a/userdiff.c b/userdiff.c
> >>> index efbe05e5a..f79adb3a3 100644
> >>> --- a/userdiff.c
> >>> +++ b/userdiff.c
> >>> @@ -79,6 +79,9 @@ PATTERNS("java",
> >>> "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
> >>> "|[-+*/<>%&^|=!]="
> >>> "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
> >>> +PATTERNS("markdown",
> >>> + "^ {0,3}#{1,6}( .*)?$",
> >>
> >> What is the purpose of making the heading text optional? Why would you
> >> want to match a sequence of hash marks without any text following it?
> >
> > Strictly speaking, a markdown heading is allowed to be empty -- see for
> > example https://spec.commonmark.org/0.29/#example-49. I'm happy to
> > change it if you think it's more useful to show a previous heading which
> > contains text than an empty one, though.
>
> I don't know what makes sense, I don't write markdown regularly. A quick
> check shows that the sequence of hashmarks appears in the hunk header.
> Is that useful? (A genuine question!)I think probably it would be more confusing to have Git silently ignore empty headings, having occasionally written documents with empty headings in the past (e.g. when I know I want some different sections, but I don't know what to call them yet). Probably not many people would ever run into this situation either way, though.