]> git.ipfire.org Git - thirdparty/git.git/commit - userdiff.c
userdiff: support Markdown
authorAsh Holland <ash@sorrel.sh>
Sat, 2 May 2020 13:15:43 +0000 (14:15 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 May 2020 01:04:12 +0000 (18:04 -0700)
commit09dad9256a32affc4a3bc0cf1fa45d5fa6f51231
tree077894ab6bd3dc84f7c030d2aec50c0847311d61
parente870325ee8575d5c3d7afe0ba2c9be072c692b65
userdiff: support Markdown

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/> but doesn't match empty headings, as
seeing them in a hunk header is unlikely to be useful.

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.

Signed-off-by: Ash Holland <ash@sorrel.sh>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitattributes.txt
t/t4018-diff-funcname.sh
t/t4018/markdown-heading-indented [new file with mode: 0644]
t/t4018/markdown-heading-non-headings [new file with mode: 0644]
userdiff.c