From: Junio C Hamano <gitster@pobox.com>
To: Ash Holland <ash@sorrel.sh>
Cc: git@vger.kernel.org, Boxuan Li <liboxuan@connect.hku.hk>,
Alban Gruin <alban.gruin@gmail.com>
Subject: Re: [PATCH v2] userdiff: support Markdown
Date: Thu, 30 Apr 2020 10:31:29 -0700 [thread overview]
Message-ID: <xmqq4kt0ubgu.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200429230509.31017-1-ash@sorrel.sh> (Ash Holland's message of "Thu, 30 Apr 2020 00:05:07 +0100")
Ash Holland <ash@sorrel.sh> writes:
> It's typical to find Markdown documentation alongside source code, and
> having better context for documentation changes is useful; see also
> commit 69f9c87d4 (userdiff: add support for Fountain documents,
> 2015-07-21).
>
> The pattern is based on the CommonMark specification 0.29, section 4.2:
> https://spec.commonmark.org/
>
> Only ATX headings are supported, as detecting setext headings would
> require printing the line before a pattern matches, or matching a
> multiline pattern. The word-diff pattern is the same as the pattern for
> HTML, because many Markdown parsers accept inline HTML.
> +PATTERNS("markdown",
> + "^ {0,3}#{1,6}( .*)?$",
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?
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.
> + "[^<>= \t]+"),
This does match the one for HTML.
In any case, let me queue this v2 as-is and see what happens.
Thanks.
next prev parent reply other threads:[~2020-04-30 17:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 1:00 [PATCH] userdiff: support Markdown Ash Holland
2020-04-21 2:22 ` Emma Brooks
2020-04-23 23:32 ` Ash Holland
2020-04-28 21:57 ` Junio C Hamano
2020-04-29 12:12 ` Ash Holland
2020-04-23 18:17 ` Johannes Sixt
2020-04-23 23:42 ` Ash Holland
2020-04-24 17:21 ` Johannes Sixt
2020-04-29 12:21 ` Ash Holland
2020-04-29 23:05 ` [PATCH v2] " Ash Holland
2020-04-30 17:31 ` Junio C Hamano [this message]
2020-05-01 11:49 ` Ash Holland
2020-05-01 14:26 ` Johannes Sixt
2020-05-02 13:15 ` [PATCH v3] " Ash Holland
2020-05-02 13:58 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq4kt0ubgu.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=alban.gruin@gmail.com \
--cc=ash@sorrel.sh \
--cc=git@vger.kernel.org \
--cc=liboxuan@connect.hku.hk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.