Skip to content

Commit dc4c393

Browse files
committed
Merge branch 'ah/userdiff-markdown'
The userdiff patterns for Markdown documents have been added. * ah/userdiff-markdown: userdiff: support Markdown
2 parents 933fdf8 + 09dad92 commit dc4c393

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,8 @@ patterns are available:
824824

825825
- `java` suitable for source code in the Java language.
826826

827+
- `markdown` suitable for Markdown documents.
828+
827829
- `matlab` suitable for source code in the MATLAB and Octave languages.
828830

829831
- `objc` suitable for source code in the Objective-C language.

t/t4018-diff-funcname.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ diffpatterns="
3838
golang
3939
html
4040
java
41+
markdown
4142
matlab
4243
objc
4344
pascal

t/t4018/markdown-heading-indented

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Indented headings are allowed, as long as the indent is no more than 3 spaces.
2+
3+
### RIGHT
4+
5+
- something
6+
- ChangeMe

t/t4018/markdown-heading-non-headings

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Headings can be right next to other lines of the file:
2+
# RIGHT
3+
Indents of four or more spaces make a code block:
4+
5+
# code comment, not heading
6+
7+
If there's no space after the final hash, it's not a heading:
8+
9+
#hashtag
10+
11+
Sequences of more than 6 hashes don't make a heading:
12+
13+
####### over-enthusiastic heading
14+
15+
So the detected heading should be right up at the start of this file.
16+
17+
ChangeMe

userdiff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ PATTERNS("java",
7979
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
8080
"|[-+*/<>%&^|=!]="
8181
"|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
82+
PATTERNS("markdown",
83+
"^ {0,3}#{1,6}[ \t].*",
84+
"[^<>= \t]+"),
8285
PATTERNS("matlab",
8386
/*
8487
* Octave pattern is mostly the same as matlab, except that '%%%' and

0 commit comments

Comments
 (0)