Skip to content

Commit

Permalink
Prohibit setext headers from starting with spaces or tabs
Browse files Browse the repository at this point in the history
Fixes an error in the setext header regular expressions. The hyphen
needs to be at the end of the class so that it isn't interpreted as a
range.  This also adds tab as a prohibited character.

This closes GH-143 and is related to GH-139. Thanks to Howard Melman
for reporting these issues.
  • Loading branch information
jrblevin committed Dec 22, 2016
1 parent c81e26f commit df4ac40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ Group 2 matches only the label, without the surrounding markup.
Group 3 matches the closing square bracket.")

(defconst markdown-regex-header
"^\\(?:\\([^\r\n- ].*\\)\n\\(?:\\(=+\\)\\|\\(-+\\)\\)\\|\\(#+\\)[ \t]+\\(.*?\\)[ \t]*\\(#*\\)\\)$"
"^\\(?:\\([^\r\n\t -].*\\)\n\\(?:\\(=+\\)\\|\\(-+\\)\\)\\|\\(#+\\)[ \t]+\\(.*?\\)[ \t]*\\(#*\\)\\)$"
"Regexp identifying Markdown headings.
Group 1 matches the text of a setext heading.
Group 2 matches the underline of a level-1 setext heading.
Expand All @@ -1287,7 +1287,7 @@ Group 5 matches the text, without surrounding whitespace, of an atx heading.
Group 6 matches the closing hash marks of an atx heading.")

(defconst markdown-regex-header-setext
"^\\([^\r\n- ].*\\)\n\\(=+\\|-+\\)$"
"^\\([^\r\n\t -].*\\)\n\\(=+\\|-+\\)$"
"Regular expression for generic setext-style (underline) headers.")

(defconst markdown-regex-header-atx
Expand Down

0 comments on commit df4ac40

Please sign in to comment.