121 Commits

Author SHA1 Message Date
Kyoh
f9f845f28f Allow colons after language identifiers in fenced code blocks 2024-12-21 12:05:17 -05:00
Tim Pope
f405b47fd8 Don't allow space between link text and URL
Resolves: https://github.com/tpope/vim-markdown/issues/212
2024-05-25 23:38:54 -04:00
flyxyz123
f2b82b7884 Fix fold inside code fences 2023-04-02 13:30:41 -04:00
Tim Pope
feadbc81e2 Vim 9.0.0772 2022-10-16 16:44:22 -04:00
Tim Pope
a282dd89fb Remove spurious blank line 2022-10-13 00:06:05 -04:00
Tim Pope
b78bbce337 Add recommended styles, per modern runtime file idiom
Both the original spec on Daring Fireball and the more rigorous
CommonMark spec state that a tab at the beginning of the line is
synonymous with 4 spaces.  For the record, I think this was a mistake,
but if you can't beat 'em, join 'em.
2022-04-02 15:40:07 -04:00
Tim Pope
b52c46dd8e Support YAML metadata
Resolves: https://github.com/tpope/vim-markdown/issues/71
2022-03-18 17:35:23 -04:00
Tim Pope
6be354e576 Allow fenced languages when embedding in another language
Resolves: https://github.com/tpope/vim-liquid/issues/15
2022-03-18 16:40:50 -04:00
Tim Pope
ff1caeadba Use "_" in generated identifiers rather than smooshing 2022-03-18 16:40:50 -04:00
Joseph Adams
891dff54a9 Adding strikethrough support via the htmlStrike highlight group
Co-authored-by: Rodrigo Haenggi <rodrigo@codegestalt.com>
2022-01-24 13:18:41 -05:00
Jaehwang Jerry Jung
59a551feb2 Don't let emphasis span multiple paragraphs
Most markdown implementations do not allow emphasis to span multiple
paragraphs. For example, commonmark.js, Markdown.pl, pandoc, and
Python-Markdown compile the following markdown

```markdown
*asdf

asdf*
```

to

```html
<p>*asdf</p>
<p>asdf*</p>
```

Some implementations compile it to

```html
<p><em>asdf</em></p>
<p>asdf*</p>
```

See https://johnmacfarlane.net/babelmark2/?normalize=1&text=*asdf%0A%0Aasdf*

Adding "^$" to :syn-end makes the emphasis end at an empty line like the
second compiled HTML above. While not perfect, it prevents an unmatched
`*` from emphasizing the entirety of the following text.
2022-01-12 12:33:36 -05:00
Jaehwang Jerry Jung
ec486958ea Require no space after/before emphasis delimiter
Many markdown implementations require that `*` be not followed (resp.
preceded) by whitespace to open (resp. close) emphasis. For example,
commonmark.js, Markdown.pl, and pandoc compile the follow markdown

```markdown
a* asdf *a
```

to

```html
<p>a* asdf *a</p>
```

On the other hand, Python-Markdown allows whitespace:

```html
<p>a<em> asdf </em>a</p>
```

See https://johnmacfarlane.net/babelmark2/?normalize=1&text=a*+asdf+*a

Since variants of commonmark (including GFM) are prevalent these days,
it makes more sense to follow the first behavior.
2022-01-12 12:33:36 -05:00
Jaehwang Jerry Jung
db82f00b58 Don't let fenced languages change 'iskeyword' 2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
c7988e88a2 Don't let fenced languages disable spell checking 2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
e2acae8cef Run :syn case match before :syn include
Syntax scripts for html and some other languages run :syn case ignore.
This may break syntax scripts of other fenced languages that implicitly
assume :syn case match.
2022-01-11 10:07:50 -05:00
Jaehwang Jerry Jung
23213f39db Fix undo_ftplugin
Add the missing bar and setl command, which previously hadn't been
necessary until the addition of [[ and ]] maps.
2022-01-10 12:09:22 -05:00
Tim Pope
ed76403b2e Change from email to URL 2021-09-13 19:13:50 -04:00
Tim Pope
82a10f4137 Always indent 4 spaces after reference-style link
References: https://github.com/vim/vim/pull/8859
2021-09-13 18:44:46 -04:00
Tim Pope
addd5abaa6 Add :syn sync linebreaks=1 to improve consistency
This was reported to fix a folding issue I can't reproduce, and also
fixes some inconsistencies such as an underline style heading failing to
highlight until a redraw.

Resolves: https://github.com/tpope/vim-markdown/issues/179
2021-06-19 13:43:31 -04:00
flyxyz123
3cdd8a9b76 Fix folding of headers adjacent to code blocks
Resolves: https://github.com/tpope/vim-markdown/issues/177
2021-06-19 13:15:26 -04:00
Anthony Geoghegan
9d87cc1917 Prevent false detection of fenced code block start
If a line begins with a word that matches one of the languages listed in
`g:markdown_fenced_languages`, the line is wrongly detected as being the
start of a fenced code block for that language. This commit ensures that
a line is only treated as the start of fenced code block if the line
begins with three or more consecutive backtick or tilde characters (with
optional leading space characters).
2021-04-21 11:29:46 -04:00
Tim Pope
855b8915e0 Do the right thing for g:markdown_folding == 0 2021-03-11 13:29:54 -05:00
Zach Himsel
65cb65a31a Use markdownCodeBlock for fenced code block regions
Given that there are two separate syntax groups for code and code
blocks, it makes sense to have the triple-backtick/tilde fenced code
blocks be labeled as such.
2021-03-10 15:30:11 -05:00
Zach Himsel
f08447c76b Fix region detection for indented code blocks
Prior to this commit, _any_ line that started with at least 4 spaces or
a tab would be considered a code block.

For example, the third level of a 2-space-indented list would be
highlighted as code, not as list items.

Note: this conforms to the original Markdown spec:
> To produce a code block in Markdown, simply indent every line of the
> block by at least 4 spaces or 1 tab.
> A code block continues until it reaches a line that is not indented
> (or the end of the article).

While this doesn't explicitly state that a blank line _before_ the code
block is required, in practical testing, it is. As such, I've included
the requirement of a blank line preceeding the indent to match the
region start.

Any line not indented by at least 4 spaces will end the region.

Closes https://github.com/tpope/vim-markdown/issues/81
Closes https://github.com/tpope/vim-markdown/issues/164
Closes https://github.com/tpope/vim-markdown/issues/94 (possibly)
Closes https://github.com/tpope/vim-markdown/pull/140
2021-03-10 15:30:11 -05:00
Konfekt
baf2592d33 Don't let fenced languages change &foldtext
Addresses the sequel to issue #154.
See https://github.com/tpope/vim-markdown/issues/154#issuecomment-778677280
2021-02-15 14:32:45 -05:00
Tim Pope
276524ed9c Mitigate performance issue with link text
References https://github.com/vim/vim/issues/6777
2020-09-08 00:19:09 -04:00
Ash Holland
a1ed88889c Recognise indented bulleted lists for wrapping 2020-09-04 18:34:22 -04:00
Greg Anders
9ff8d52c78 Update header pattern to include trailing space or tab (#168) 2020-07-24 00:40:03 -04:00
Tim Pope
296eeaa887 Support tilde code blocks
Also ensure the end marker has the same number of delimiter characters
as the start marker.

Closes https://github.com/tpope/vim-markdown/issues/156
2020-02-21 00:25:51 -05:00
Greg Anders
f35c43c535 Update [[ and ]] mappings
1. Add support for setext style headings
2. Use the 's' flag in search() to set the ' mark instead of using m'
3. Fix the guard
2020-02-01 11:47:08 -05:00
Tim Pope
6c4c60fbaa Also don't let HTML and dependent syntaxes change 'foldmethod'
References https://github.com/tpope/vim-markdown/issues/154
2020-01-30 12:56:09 -05:00
Tim Pope
719b046bbe Don't let fenced language syntaxes change 'foldmethod'
Closes https://github.com/tpope/vim-markdown/issues/154
2020-01-30 12:45:09 -05:00
Tim Pope
191438f358 Add [[ and ]] maps
Hat tip to Joe Reynolds for the idea.
2020-01-30 11:57:41 -05:00
Tim Pope
4e25b2f606 Vim 8.2.0141 2020-01-30 11:50:49 -05:00
Tim Pope
e875717243 Fix closing italics
Closes https://github.com/tpope/vim-markdown/issues/151
2019-12-12 13:55:26 -05:00
Tim Pope
a273e6d1f3 Vim 8.2 vim8.2 2019-12-12 13:54:51 -05:00
Tim Pope
9c2133fef0 Skip escaped bold/italics closer
Closes https://github.com/tpope/vim-markdown/issues/102
2019-12-02 08:47:20 -05:00
Igor Mikushkin
8a76c845de Github flavored parsing of underscores 2019-12-01 07:42:25 -05:00
Tim Pope
1a436852ac Clean up folding code 2019-12-01 04:27:35 -05:00
Tim Pope
06a62df8a5 Restrict HTML highlighting when nesting
Closes https://github.com/tpope/vim-markdown/issues/148
2019-11-23 16:02:45 -05:00
Tim Pope
a6866ac0aa Add sponsor button 2019-11-12 19:30:03 -05:00
Tim Pope
5363a4d803 Allow one level of nested brackets
Closes https://github.com/tpope/vim-markdown/issues/129
2019-10-23 03:03:09 -04:00
Greg Anders
64689dfeae Support pandoc syntax for fenced code blocks 2019-10-10 18:10:49 -04:00
Alex Vear
a2e123a288 Prevent the folding of heading syntax in code fences
Previously in Markdown files, Vim would treat heading syntax in code
fences as Markdown headers. This commit ensures that only headers will
be folded by checking the 'synIDattr' of the item.

E.g. The comment in this code snippet would have been treated as a
Markdown header.

```sh
 # This is a comment
 echo "Hello world"
```
2019-08-15 18:53:44 -04:00
Thomas Faingnaert
c043a93c84 Conceal code blocks 2019-07-28 19:37:25 -04:00
David Palma
fd3f4831be Fix for slowness due to folds (#143) 2019-07-24 16:59:55 -04:00
Daniel M. Capella
57c58269a2 readme: Upstream matches *.md to Markdown
Introduced in late 2014:
7d76c804af (diff-44a099e40ae628aef90a28c6408a4c61R1154)
2019-03-12 23:54:34 -04:00
Florian Heiderich
e2d7fcd682 add .mdwn file extension 2018-02-04 23:47:43 -05:00
Alex Griffin
8cd41796fd Separate highlight groups for each heading level
Closes tpope#123.
2017-10-17 20:30:01 -04:00
Tim Pope
a7dbc31456 Three or more backticks, not two or more 2017-05-08 11:37:43 -04:00