-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip ci] fix(vim): unhighlight unescaped underscores in Markdown doc…
…uments
- Loading branch information
1 parent
8fe776b
commit 4f22cc0
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
" Stop highlighting unescaped underscores in the middle of a word as an error. | ||
" | ||
" Consistency is key, and with the way things are now, people are more likely | ||
" to remove escaping instead of introducing it. | ||
" | ||
" While the original Markdown spec treats underscores in the middle of a word | ||
" as an emphasis [1], only 2 out of 28 implementations treat it that way | ||
" instead of treating it as a literal underscore at the time of writing [2]. | ||
" Of the 2, Pandoc only does so in an opt-in strict mode. Prettier, a popular | ||
" formatter for Markdown, even unescapes them [3]. | ||
" | ||
" While there are currently no settings to unhighlight individual errors [4] | ||
" [5], this fix takes care not to unhighlight any other errors that might get | ||
" added in the future [6]. | ||
" | ||
" [1]: https://daringfireball.net/projects/markdown/syntax#em | ||
" [2]: https://babelmark.github.io/?text=foo_bar_baz | ||
" [3]: https://github.com/prettier/prettier/issues/3728 | ||
" [4]: https://github.com/tpope/vim-markdown/issues/21 | ||
" [5]: $VIMRUNTIME/syntax/markdown.vim (jump to file with gf) | ||
" [6]: See :help :syn-transparent | ||
syn match markdownIgnore "\w\@<=_\w\@=" transparent contains=NONE | ||
syn cluster markdownInline add=markdownIgnore |