From: martin f. krafft Date: Tue, 8 Apr 2025 15:01:19 +0000 (+0200) Subject: Merge commit 'c58a4f3586473f7476510714698e60835fcb94ef' X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e?hp=-c Merge commit 'c58a4f3586473f7476510714698e60835fcb94ef' --- 0ee596c5c5e11fc79598407eaf22f83d279f7e9e diff --combined .vim/bundle/vim-markdown/.github/workflows/reviewdog.yml index 00000000,421e438b..421e438b mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/.github/workflows/reviewdog.yml +++ b/.vim/bundle/vim-markdown/.github/workflows/reviewdog.yml @@@ -1,0 -1,13 +1,13 @@@ + name: Reviewdog + on: [pull_request] + jobs: + vint: + name: vint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: vint + uses: reviewdog/action-vint@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review diff --combined .vim/bundle/vim-markdown/.github/workflows/vader.yml index 00000000,05b12ecb..05b12ecb mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/.github/workflows/vader.yml +++ b/.vim/bundle/vim-markdown/.github/workflows/vader.yml @@@ -1,0 -1,31 +1,31 @@@ + name: Vader + on: [push, pull_request] + jobs: + vader: + name: vader + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + vimFlavor: ["vim", "nvim"] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Enable Universe package repository + run: | + sudo add-apt-repository universe + sudo apt-get update + - name: Install ${{ matrix.vimFlavor }} + run: | + sudo apt-get install ${{ matrix.vimFlavor == 'nvim' && 'neovim' || 'vim' }} + - name: Review versions + run: | + ${{ matrix.vimFlavor }} --version + - name: Fetch Vader and other dependencies + run: | + make build/tabular build/vim-toml build/vim-json build/vader.vim + - name: Run test suite + run: | + cd test + ${{ matrix.vimFlavor == 'nvim' && 'nvim --headless' || 'vim -N' }} \ + -u vimrc "+Vader! *" diff --combined .vim/bundle/vim-markdown/.github/workflows/vint.yml index 00000000,909de43a..909de43a mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/.github/workflows/vint.yml +++ b/.vim/bundle/vim-markdown/.github/workflows/vint.yml @@@ -1,0 -1,15 +1,15 @@@ + name: Vint + on: [push] + jobs: + vint: + name: vint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + - name: Setup dependencies + run: pip install vim-vint + - name: Lint Vimscript + run: vint . diff --combined .vim/bundle/vim-markdown/.vintrc.yaml index 00000000,c44b6aba..c44b6aba mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/.vintrc.yaml +++ b/.vim/bundle/vim-markdown/.vintrc.yaml @@@ -1,0 -1,5 +1,5 @@@ + cmdargs: + severity: style_problem + color: true + env: + neovim: false diff --combined .vim/bundle/vim-markdown/CONTRIBUTING.md index 86912a4a,736f0238..736f0238 --- a/.vim/bundle/vim-markdown/CONTRIBUTING.md +++ b/.vim/bundle/vim-markdown/CONTRIBUTING.md @@@ -34,7 -34,7 +34,7 @@@ There are many flavors of markdown, eac ## Style - When choosing between multiple valid Markdown syntaxes, the default behavior must be that specified at: + When choosing between multiple valid Markdown syntaxes, the default behavior must be that specified at: If you wish to have a behavior that differs from that style guide, add an option to turn it on or off, and leave it off by default. @@@ -46,7 -46,7 +46,7 @@@ All new features must have unit tests Issues are tracked within GitHub. - When reporting issues, your report is more effective if you include a minimal example file that reproduces the problem. Try to trim out as much as possible, until you have the smallest possible file that still reproduces the issue. Paste the example inline into your issue report, quoted using four spaces at the beginning of each line, like this example from issue [#189](https://github.com/plasticboy/vim-markdown/issues/189): + When reporting issues, your report is more effective if you include a minimal example file that reproduces the problem. Try to trim out as much as possible, until you have the smallest possible file that still reproduces the issue. Paste the example inline into your issue report, quoted using four spaces at the beginning of each line, like this example from issue [#189](https://github.com/preservim/vim-markdown/issues/189): ``` Minimal example: diff --combined .vim/bundle/vim-markdown/README.md index fd3be687,3ccf5325..3ccf5325 --- a/.vim/bundle/vim-markdown/README.md +++ b/.vim/bundle/vim-markdown/README.md @@@ -1,6 -1,7 +1,7 @@@ # Vim Markdown - [![Build Status](https://travis-ci.org/plasticboy/vim-markdown.svg)](https://travis-ci.org/plasticboy/vim-markdown) + [![Vint](https://github.com/preservim/vim-markdown/workflows/Vint/badge.svg)](https://github.com/preservim/vim-markdown/actions?workflow=Vint) + [![Vader](https://github.com/preservim/vim-markdown/workflows/Vader/badge.svg)](https://github.com/preservim/vim-markdown/actions?workflow=Vader) Syntax highlighting, matching rules and mappings for [the original Markdown](http://daringfireball.net/projects/markdown/) and extensions. @@@ -18,7 -19,7 +19,7 @@@ If you use [Vundle](https://github.com/ ```vim Plugin 'godlygeek/tabular' - Plugin 'plasticboy/vim-markdown' + Plugin 'preservim/vim-markdown' ``` The `tabular` plugin must come *before* `vim-markdown`. @@@ -34,19 -35,21 +35,21 @@@ If you use [Pathogen](https://github.co ```sh cd ~/.vim/bundle - git clone https://github.com/plasticboy/vim-markdown.git + git clone https://github.com/preservim/vim-markdown.git ``` To install without Pathogen using the Debian [vim-addon-manager](http://packages.qa.debian.org/v/vim-addon-manager.html), do this: ```sh - git clone https://github.com/plasticboy/vim-markdown.git + git clone https://github.com/preservim/vim-markdown.git cd vim-markdown sudo make install vim-addon-manager install markdown ``` - If you are not using any package manager, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this: + If you are using a package manager with semver support (like [lazy.nvim](https://github.com/folke/lazy.nvim)) make sure you are following the master branch (see https://github.com/preservim/vim-markdown/issues/616). + + If you are not using any package manager, download the [tarball](https://github.com/preservim/vim-markdown/archive/master.tar.gz) and do this: ```sh cd ~/.vim @@@ -65,8 -68,10 +68,10 @@@ The following commands are useful to op - `zR`: opens all folds - `zm`: increases fold level throughout the buffer - `zM`: folds everything all the way - - `za`: open a fold your cursor is on - - `zA`: open a fold your cursor is on recursively + - `za`: toggle a fold your cursor is on + - `zA`: toggle a fold your cursor is on recursively + - `zo`: open a fold your cursor is on + - `zO`: open a fold your cursor is on recursively - `zc`: close a fold your cursor is on - `zC`: close a fold your cursor is on recursively @@@ -261,8 -266,6 +266,6 @@@ The following options control which syn Highlight TOML front matter as used by [Hugo](https://gohugo.io/content/front-matter/). - TOML syntax highlight requires [vim-toml](https://github.com/cespare/vim-toml). - let g:vim_markdown_toml_frontmatter = 1 #### JSON Front Matter @@@ -271,8 -274,6 +274,6 @@@ Highlight JSON front matter as used by [Hugo](https://gohugo.io/content/front-matter/). - JSON syntax highlight requires [vim-json](https://github.com/elzr/vim-json). - let g:vim_markdown_json_frontmatter = 1 #### Strikethrough @@@ -350,6 -351,27 +351,27 @@@ let g:vim_markdown_edit_url_in = 'tab' + ### Borderless tables + + - `g:vim_markdown_borderless_table` + + Add support for borderless tables, such as: + ``` + header 1|header 2 + --|-- + data 1|data 2 + ``` + if set to `1`: + + let g:vim_markdown_borderless_table = 1 + + the table would be formatted as usual: + ``` + | header 1 | header 2 | + |----------|----------| + | data 1 | data 2 | + ``` + ## Mappings The following work on normal and visual modes: @@@ -370,19 -392,19 +392,19 @@@ Known limitation: does not work for links that span multiple lines. - - `ge`: open the link under the cursor in Vim for editing. Useful for relative markdown links. `Markdown_EditUrlUnderCursor` + - `ge`: open the link under the cursor in Vim for editing. Useful for relative markdown links. Falls back to `gf` with force editing, if not on a markdown link. `Markdown_EditUrlUnderCursor` The rules for the cursor position are the same as the `gx` command. - `]]`: go to next header. `Markdown_MoveToNextHeader` - - `[[`: go to previous header. Contrast with `]c`. `Markdown_MoveToPreviousHeader` + - `[[`: go to previous header. Contrast with `]h`. `Markdown_MoveToPreviousHeader` - `][`: go to next sibling header if any. `Markdown_MoveToNextSiblingHeader` - `[]`: go to previous sibling header if any. `Markdown_MoveToPreviousSiblingHeader` - - `]c`: go to Current header. `Markdown_MoveToCurHeader` + - `]h`: go to Current header. `Markdown_MoveToCurHeader` - `]u`: go to parent header (Up). `Markdown_MoveToParentHeader` @@@ -433,11 -455,17 +455,17 @@@ The following requires `:filetype plugi - `:Tocv`: Same as `:Toc` for symmetry with `:Toch` and `:Tocv`. + - `:InsertToc`: Insert table of contents at the current line. + + An optional argument can be used to specify how many levels of headers to display in the table of content, e.g., to display up to and including `h3`, use `:InsertToc 3`. + + - `:InsertNToc`: Same as `:InsertToc`, but the format of `h2` headers in the table of contents is a numbered list, rather than a bulleted list. + ## Credits The main contributors of vim-markdown are: - - **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-markdown. [Homepage](http://plasticboy.com/). + - **Ben Williams** (A.K.A. **@plasticboy**). The original developer of vim-markdown. [Homepage](http://plasticboy.com/). If you feel that your name should be on this list, please make a pull request listing your contributions. diff --combined .vim/bundle/vim-markdown/after/ftplugin/markdown.vim index 8be6ff91,390515ff..390515ff --- a/.vim/bundle/vim-markdown/after/ftplugin/markdown.vim +++ b/.vim/bundle/vim-markdown/after/ftplugin/markdown.vim @@@ -9,35 -9,41 +9,41 @@@ function! s:is_mkdCode(lnum) let name = synIDattr(synID(a:lnum, 1, 0), 'name') - return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)') + return (name =~# '^mkd\%(Code$\|Snippet\)' || name !=# '' && name !~? '^\%(mkd\|html\)') endfunction - if get(g:, "vim_markdown_folding_style_pythonic", 0) + if get(g:, 'vim_markdown_folding_style_pythonic', 0) function! Foldexpr_markdown(lnum) + if (a:lnum == 1) + let b:fence_str = '' + endif + let l1 = getline(a:lnum) "~~~~~ keep track of fenced code blocks ~~~~~ "If we hit a code block fence - if l1 =~ '````*' || l1 =~ '\~\~\~\~*' + if l1 =~# '\v^[[:space:]>]*\v(`{3,}|\~{3,})\s*(\w+)?\s*$' " toggle the variable that says if we're in a code block if b:fenced_block == 0 let b:fenced_block = 1 - elseif b:fenced_block == 1 + let b:fence_str = matchstr(l1, '\v(`{3,}|\~{3,})') + elseif b:fenced_block == 1 && matchstr(l1, '\v(`{3,}|\~{3,})') ==# b:fence_str let b:fenced_block = 0 + let b:fence_str = '' endif " else, if we're caring about front matter - elseif g:vim_markdown_frontmatter == 1 + elseif get(g:, 'vim_markdown_frontmatter', 0) == 1 " if we're in front matter and not on line 1 if b:front_matter == 1 && a:lnum > 2 let l0 = getline(a:lnum-1) " if the previous line fenced front matter - if l0 == '---' + if l0 ==# '---' " we must not be in front matter let b:front_matter = 0 endif " else, if we're on line one elseif a:lnum == 1 " if we hit a front matter fence - if l1 == '---' + if l1 ==# '---' " we're in the front matter let b:front_matter = 1 endif @@@ -45,8 -51,8 +51,8 @@@ endif " if we're in a code block or front matter - if b:fenced_block == 1 || b:front_matter == 1 - if a:lnum == 1 + if b:fenced_block ==# 1 || b:front_matter ==# 1 + if a:lnum ==# 1 " fold any 'preamble' return '>1' else @@@ -58,18 -64,19 +64,19 @@@ let l2 = getline(a:lnum+1) " if the next line starts with two or more '=' " and is not code - if l2 =~ '^==\+\s*' && !s:is_mkdCode(a:lnum+1) + if l2 =~# '^==\+\s*' && !s:is_mkdCode(a:lnum+1) " next line is underlined (level 1) return '>0' " else, if the nex line starts with two or more '-' + " but is not comment closer (-->) " and is not code - elseif l2 =~ '^--\+\s*' && !s:is_mkdCode(a:lnum+1) + elseif l2 =~# '^--\+\s*$' && !s:is_mkdCode(a:lnum+1) " next line is underlined (level 2) return '>1' endif "if we're on a non-code line starting with a pound sign - if l1 =~ '^#' && !s:is_mkdCode(a:lnum) + if l1 =~# '^#' && !s:is_mkdCode(a:lnum) " set the fold level to the number of hashes -1 " return '>'.(matchend(l1, '^#\+') - 1) " set the fold level to the number of hashes @@@ -87,36 -94,39 +94,39 @@@ function! Foldtext_markdown() let line = getline(v:foldstart) let has_numbers = &number || &relativenumber - let nucolwidth = &fdc + has_numbers * &numberwidth + let nucolwidth = &foldcolumn + has_numbers * &numberwidth let windowwidth = winwidth(0) - nucolwidth - 6 let foldedlinecount = v:foldend - v:foldstart let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount)) let line = substitute(line, '\%("""\|''''''\)', '', '') let fillcharcount = windowwidth - len(line) - len(foldedlinecount) + 1 - return line . ' ' . repeat("-", fillcharcount) . ' ' . foldedlinecount + return line . ' ' . repeat('-', fillcharcount) . ' ' . foldedlinecount endfunction else " vim_markdown_folding_style_pythonic == 0 function! Foldexpr_markdown(lnum) if (a:lnum == 1) let l0 = '' + let b:fence_str = '' else let l0 = getline(a:lnum-1) endif " keep track of fenced code blocks - if l0 =~ '````*' || l0 =~ '\~\~\~\~*' + if l0 =~# '\v^[[:space:]>]*\v(`{3,}|\~{3,})\s*(\w+)?\s*$' if b:fenced_block == 0 let b:fenced_block = 1 - elseif b:fenced_block == 1 + let b:fence_str = matchstr(l0, '\v(`{3,}|\~{3,})') + elseif b:fenced_block == 1 && matchstr(l0, '\v(`{3,}|\~{3,})') ==# b:fence_str let b:fenced_block = 0 + let b:fence_str = '' endif - elseif g:vim_markdown_frontmatter == 1 + elseif get(g:, 'vim_markdown_frontmatter', 0) == 1 if b:front_matter == 1 - if l0 == '---' + if l0 ==# '---' let b:front_matter = 0 endif elseif a:lnum == 2 - if l0 == '---' + if l0 ==# '---' let b:front_matter = 1 endif endif @@@ -128,10 -138,10 +138,10 @@@ endif let l2 = getline(a:lnum+1) - if l2 =~ '^==\+\s*' && !s:is_mkdCode(a:lnum+1) + if l2 =~# '^==\+\s*' && !s:is_mkdCode(a:lnum+1) " next line is underlined (level 1) return '>1' - elseif l2 =~ '^--\+\s*' && !s:is_mkdCode(a:lnum+1) + elseif l2 =~# '^--\+\s*$' && !s:is_mkdCode(a:lnum+1) " next line is underlined (level 2) if s:vim_markdown_folding_level >= 2 return '>1' @@@ -141,7 -151,7 +151,7 @@@ endif let l1 = getline(a:lnum) - if l1 =~ '^#' && !s:is_mkdCode(a:lnum) + if l1 =~# '^#' && !s:is_mkdCode(a:lnum) " fold level according to option if s:vim_markdown_folding_level == 1 || matchend(l1, '^#\+') > s:vim_markdown_folding_level if a:lnum == line('$') @@@ -155,7 -165,7 +165,7 @@@ endif endif - if l0 =~ '^#' && !s:is_mkdCode(a:lnum-1) + if l0 =~# '^#' && !s:is_mkdCode(a:lnum-1) " previous line starts with hashes return '>'.matchend(l0, '^#\+') else @@@ -168,12 -178,12 +178,12 @@@ endi let b:fenced_block = 0 let b:front_matter = 0 - let s:vim_markdown_folding_level = get(g:, "vim_markdown_folding_level", 1) + let s:vim_markdown_folding_level = get(g:, 'vim_markdown_folding_level', 1) function! s:MarkdownSetupFolding() - if !get(g:, "vim_markdown_folding_disabled", 0) - if get(g:, "vim_markdown_folding_style_pythonic", 0) - if get(g:, "vim_markdown_override_foldtext", 1) + if !get(g:, 'vim_markdown_folding_disabled', 0) + if get(g:, 'vim_markdown_folding_style_pythonic', 0) + if get(g:, 'vim_markdown_override_foldtext', 1) setlocal foldtext=Foldtext_markdown() endif endif @@@ -183,9 -193,9 +193,9 @@@ endfunction function! s:MarkdownSetupFoldLevel() - if get(g:, "vim_markdown_folding_style_pythonic", 0) + if get(g:, 'vim_markdown_folding_style_pythonic', 0) " set default foldlevel - execute "setlocal foldlevel=".s:vim_markdown_folding_level + execute 'setlocal foldlevel='.s:vim_markdown_folding_level endif endfunction diff --combined .vim/bundle/vim-markdown/doc/vim-markdown.txt index 4d731293,3e843571..3e843571 --- a/.vim/bundle/vim-markdown/doc/vim-markdown.txt +++ b/.vim/bundle/vim-markdown/doc/vim-markdown.txt @@@ -55,7 -55,7 +55,7 @@@ Installation If you use Vundle [2], add the following lines to your '~/.vimrc': > Plugin 'godlygeek/tabular' - Plugin 'plasticboy/vim-markdown' + Plugin 'preservim/vim-markdown' < The 'tabular' plugin must come _before_ 'vim-markdown'. @@@ -67,11 -67,11 +67,11 @@@ Then run inside Vim If you use Pathogen [3], do this: > cd ~/.vim/bundle - git clone https://github.com/plasticboy/vim-markdown.git + git clone https://github.com/preservim/vim-markdown.git < To install without Pathogen using the Debian vim-addon-manager [4], do this: > - git clone https://github.com/plasticboy/vim-markdown.git + git clone https://github.com/preservim/vim-markdown.git cd vim-markdown sudo make install vim-addon-manager install markdown @@@ -102,9 -102,13 +102,13 @@@ The following commands are useful to op *vim-markdown-zM* - 'zM': folds everything all the way *vim-markdown-za* - - 'za': open a fold your cursor is on + - 'za': toggle a fold your cursor is on *vim-markdown-zA* - - 'zA': open a fold your cursor is on recursively + - 'zA': toggle a fold your cursor is on recursively + *vim-markdown-zo* + - 'zo': open a fold your cursor is on + *vim-markdown-zO* + - 'zO': open a fold your cursor is on recursively *vim-markdown-zc* - 'zc': close a fold your cursor is on *vim-markdown-zC* @@@ -490,6 -494,30 +494,30 @@@ Change how to open new files > let g:vim_markdown_edit_url_in = 'tab' < + ------------------------------------------------------------------------------- + *vim-markdown-support-borderless-tables* + Support borderless tables ~ + + *g:vim_markdown_borderless_table* + - 'g:vim_markdown_borderless_table' + + Add support for borderless tables, such as: + > + header 1|header 2 + --|-- + data 1|data 2 + < + if set to 1: + > + let g:vim_markdown_borderless_table = 1 + < + the table would be formatted as usual: + > + | header 1 | header 2 | + |----------|----------| + | data 1 | data 2 | + < + =============================================================================== *vim-markdown-mappings* Mappings ~ @@@ -525,7 -553,7 +553,7 @@@ The following work on normal and visua - ']]': go to next header. 'Markdown_MoveToNextHeader' *vim-markdown-[[* - - '[[': go to previous header. Contrast with ']c'. + - '[[': go to previous header. Contrast with ']h'. 'Markdown_MoveToPreviousHeader' *vim-markdown-][* @@@ -536,8 -564,8 +564,8 @@@ - '[]': go to previous sibling header if any. 'Markdown_MoveToPreviousSiblingHeader' - *vim-markdown-]c* - - ']c': go to Current header. 'Markdown_MoveToCurHeader' + *vim-markdown-]h* + - ']h': go to Current header. 'Markdown_MoveToCurHeader' *vim-markdown-]u* - ']u': go to parent header (Up). 'Markdown_MoveToParentHeader' @@@ -651,7 -679,7 +679,7 @@@ References [2] https://github.com/gmarik/vundle [3] https://github.com/tpope/vim-pathogen [4] http://packages.qa.debian.org/v/vim-addon-manager.html - [5] https://github.com/plasticboy/vim-markdown/archive/master.tar.gz + [5] https://github.com/preservim/vim-markdown/archive/master.tar.gz [6] https://github.com/klen/python-mode [7] https://gohugo.io/content/front-matter/ [8] https://github.com/cespare/vim-toml diff --combined .vim/bundle/vim-markdown/ftdetect/markdown.vim index 07682da4,e7c6f864..e7c6f864 --- a/.vim/bundle/vim-markdown/ftdetect/markdown.vim +++ b/.vim/bundle/vim-markdown/ftdetect/markdown.vim @@@ -3,6 -3,6 +3,6 @@@ if !has('patch-7.4.480' au! filetypedetect BufRead,BufNewFile *.md endif - " markdown filetype file - au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown - au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown + " vint: -ProhibitAutocmdWithNoGroup + au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown + au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown diff --combined .vim/bundle/vim-markdown/ftplugin/markdown.vim index 200293e8,33ed3cc9..33ed3cc9 --- a/.vim/bundle/vim-markdown/ftplugin/markdown.vim +++ b/.vim/bundle/vim-markdown/ftplugin/markdown.vim @@@ -1,6 -1,6 +1,6 @@@ "TODO print messages when on visual mode. I only see VISUAL, not the messages. - " Function interface phylosophy: + " Function interface philosophy: " " - functions take arbitrary line numbers as parameters. " Current cursor line is only a suitable default parameter. @@@ -56,7 -56,7 +56,7 @@@ let s:levelRegexpDict = \ 6: '\v^######[^#]@=' \ } - " Maches any header level of any type. + " Matches any header level of any type. " " This could be deduced from `s:levelRegexpDict`, but it is more " efficient to have a single regexp for this. @@@ -94,7 -94,7 +94,7 @@@ endfunctio " function! s:MoveToCurHeader() let l:lineNum = s:GetHeaderLineNum() - if l:lineNum != 0 + if l:lineNum !=# 0 call cursor(l:lineNum, 1) else echo 'outside any header' @@@ -147,13 -147,68 +147,68 @@@ function! s:GetHeaderLevel(... let l:line = a:1 endif let l:linenum = s:GetHeaderLineNum(l:line) - if l:linenum != 0 + if l:linenum !=# 0 return s:GetLevelOfHeaderAtLine(l:linenum) else return 0 endif endfunction + " Return list of headers and their levels. + " + function! s:GetHeaderList() + let l:bufnr = bufnr('%') + let l:fenced_block = 0 + let l:front_matter = 0 + let l:header_list = [] + let l:vim_markdown_frontmatter = get(g:, 'vim_markdown_frontmatter', 0) + let l:fence_str = '' + for i in range(1, line('$')) + let l:lineraw = getline(i) + let l:l1 = getline(i+1) + let l:line = substitute(l:lineraw, '#', "\\\#", 'g') + " exclude lines in fenced code blocks + if l:line =~# '\v^[[:space:]>]*(`{3,}|\~{3,})\s*(\w+)?\s*$' + if l:fenced_block == 0 + let l:fenced_block = 1 + let l:fence_str = matchstr(l:line, '\v(`{3,}|\~{3,})') + elseif l:fenced_block == 1 && matchstr(l:line, '\v(`{3,}|\~{3,})') ==# l:fence_str + let l:fenced_block = 0 + let l:fence_str = '' + endif + " exclude lines in frontmatters + elseif l:vim_markdown_frontmatter == 1 + if l:front_matter == 1 + if l:line ==# '---' + let l:front_matter = 0 + endif + elseif i == 1 + if l:line ==# '---' + let l:front_matter = 1 + endif + endif + endif + " match line against header regex + if join(getline(i, i + 1), "\n") =~# s:headersRegexp && l:line =~# '^\S' + let l:is_header = 1 + else + let l:is_header = 0 + endif + if l:is_header ==# 1 && l:fenced_block ==# 0 && l:front_matter ==# 0 + " remove hashes from atx headers + if match(l:line, '^#') > -1 + let l:line = substitute(l:line, '\v^#*[ ]*', '', '') + let l:line = substitute(l:line, '\v[ ]*#*$', '', '') + endif + " append line to list + let l:level = s:GetHeaderLevel(i) + let l:item = {'level': l:level, 'text': l:line, 'lnum': i, 'bufnr': bufnr} + let l:header_list = l:header_list + [l:item] + endif + endfor + return l:header_list + endfunction + " Returns the level of the header at the given line. " " If there is no header at the given line, returns `0`. @@@ -175,6 -230,7 +230,7 @@@ endfunctio function! s:MoveToParentHeader() let l:linenum = s:GetParentHeaderLineNumber() if l:linenum != 0 + call setpos("''", getpos('.')) call cursor(l:linenum, 1) else echo 'no parent header' @@@ -303,65 -359,38 +359,38 @@@ function! s:Toc(... endif - let l:bufnr = bufnr('%') let l:cursor_line = line('.') let l:cursor_header = 0 - let l:fenced_block = 0 - let l:front_matter = 0 - let l:header_list = [] + let l:header_list = s:GetHeaderList() + let l:indented_header_list = [] + if len(l:header_list) == 0 + echom 'Toc: No headers.' + return + endif let l:header_max_len = 0 - let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0) - let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0) - for i in range(1, line('$')) - let l:lineraw = getline(i) - let l:l1 = getline(i+1) - let l:line = substitute(l:lineraw, "#", "\\\#", "g") - if l:line =~ '````*' || l:line =~ '\~\~\~\~*' - if l:fenced_block == 0 - let l:fenced_block = 1 - elseif l:fenced_block == 1 - let l:fenced_block = 0 - endif - elseif l:vim_markdown_frontmatter == 1 - if l:front_matter == 1 - if l:line == '---' - let l:front_matter = 0 - endif - elseif i == 1 - if l:line == '---' - let l:front_matter = 1 - endif + let l:vim_markdown_toc_autofit = get(g:, 'vim_markdown_toc_autofit', 0) + for h in l:header_list + " set header number of the cursor position + if l:cursor_header == 0 + let l:header_line = h.lnum + if l:header_line == l:cursor_line + let l:cursor_header = index(l:header_list, h) + 1 + elseif l:header_line > l:cursor_line + let l:cursor_header = index(l:header_list, h) endif endif - if l:line =~ '^#\+' || (l:l1 =~ '^=\+\s*$' || l:l1 =~ '^-\+\s*$') && l:line =~ '^\S' - let l:is_header = 1 - else - let l:is_header = 0 - endif - if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0 - " append line to location list - let l:item = {'lnum': i, 'text': l:line, 'valid': 1, 'bufnr': l:bufnr, 'col': 1} - let l:header_list = l:header_list + [l:item] - " set header number of the cursor position - if l:cursor_header == 0 - if i == l:cursor_line - let l:cursor_header = len(l:header_list) - elseif i > l:cursor_line - let l:cursor_header = len(l:header_list) - 1 - endif - endif - " keep track of the longest header size (heading level + title) - let l:total_len = stridx(l:line, ' ') + strdisplaywidth(l:line) - if l:total_len > l:header_max_len - let l:header_max_len = l:total_len - endif + " indent header based on level + let l:text = repeat(' ', h.level-1) . h.text + " keep track of the longest header size (heading level + title) + let l:total_len = strdisplaywidth(l:text) + if l:total_len > l:header_max_len + let l:header_max_len = l:total_len endif + " append indented line to list + let l:item = {'lnum': h.lnum, 'text': l:text, 'valid': 1, 'bufnr': h.bufnr, 'col': 1} + let l:indented_header_list = l:indented_header_list + [l:item] endfor - call setloclist(0, l:header_list) - if len(l:header_list) == 0 - echom "Toc: No headers." - return - endif + call setloclist(0, l:indented_header_list) if l:window_type ==# 'horizontal' lopen @@@ -369,7 -398,8 +398,8 @@@ vertical lopen " auto-fit toc window when possible to shrink it if (&columns/2) > l:header_max_len && l:vim_markdown_toc_autofit == 1 - execute 'vertical resize ' . (l:header_max_len + 1) + " header_max_len + 1 space for first header + 3 spaces for line numbers + execute 'vertical resize ' . (l:header_max_len + 1 + 3) else execute 'vertical resize ' . (&columns/2) endif @@@ -382,27 -412,84 +412,84 @@@ for i in range(1, line('$')) " this is the location-list data for the current item let d = getloclist(0)[i-1] - " atx headers - if match(d.text, "^#") > -1 - let l:level = len(matchstr(d.text, '#*', 'g'))-1 - let d.text = substitute(d.text, '\v^#*[ ]*', '', '') - let d.text = substitute(d.text, '\v[ ]*#*$', '', '') - " setex headers - else - let l:next_line = getbufline(d.bufnr, d.lnum+1) - if match(l:next_line, "=") > -1 - let l:level = 0 - elseif match(l:next_line, "-") > -1 - let l:level = 1 - endif - endif - call setline(i, repeat(' ', l:level). d.text) + call setline(i, d.text) endfor setlocal nomodified setlocal nomodifiable execute 'normal! ' . l:cursor_header . 'G' endfunction + function! s:InsertToc(format, ...) + if a:0 > 0 + if type(a:1) != type(0) + echohl WarningMsg + echomsg '[vim-markdown] Invalid argument, must be an integer >= 2.' + echohl None + return + endif + let l:max_level = a:1 + if l:max_level < 2 + echohl WarningMsg + echomsg '[vim-markdown] Maximum level cannot be smaller than 2.' + echohl None + return + endif + else + let l:max_level = 0 + endif + + let l:toc = [] + let l:header_list = s:GetHeaderList() + if len(l:header_list) == 0 + echom 'InsertToc: No headers.' + return + endif + + if a:format ==# 'numbers' + let l:h2_count = 0 + for header in l:header_list + if header.level == 2 + let l:h2_count += 1 + endif + endfor + let l:max_h2_number_len = strlen(string(l:h2_count)) + else + let l:max_h2_number_len = 0 + endif + + let l:h2_count = 0 + for header in l:header_list + let l:level = header.level + if l:level == 1 + " skip level-1 headers + continue + elseif l:max_level != 0 && l:level > l:max_level + " skip unwanted levels + continue + elseif l:level == 2 + " list of level-2 headers can be bullets or numbers + if a:format ==# 'bullets' + let l:indent = '' + let l:marker = '* ' + else + let l:h2_count += 1 + let l:number_len = strlen(string(l:h2_count)) + let l:indent = repeat(' ', l:max_h2_number_len - l:number_len) + let l:marker = l:h2_count . '. ' + endif + else + let l:indent = repeat(' ', l:max_h2_number_len + 2 * (l:level - 2)) + let l:marker = '* ' + endif + let l:text = '[' . header.text . ']' + let l:link = '(#' . substitute(tolower(header.text), '\v[ ]+', '-', 'g') . ')' + let l:line = l:indent . l:marker . l:text . l:link + let l:toc = l:toc + [l:line] + endfor + + call append(line('.'), l:toc) + endfunction + " Convert Setex headers in range `line1 .. line2` to Atx. " " Return the number of conversions. @@@ -410,7 -497,9 +497,9 @@@ function! s:SetexToAtx(line1, line2) let l:originalNumLines = line('$') execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n\=+$/# \1/' - execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n-+$/## \1/' + + let l:changed = l:originalNumLines - line('$') + execute 'silent! ' . a:line1 . ',' . (a:line2 - l:changed) . 'substitute/\v(.*\S.*)\n-+$/## \1' return l:originalNumLines - line('$') endfunction @@@ -452,6 -541,19 +541,19 @@@ endfunctio " function! s:TableFormat() let l:pos = getpos('.') + + if get(g:, 'vim_markdown_borderless_table', 0) + " add `|` to the beginning of the line if it isn't present + normal! { + call search('|') + execute 'silent .,''}s/\v^(\s{0,})\|?([^\|])/\1|\2/e' + + " add `|` to the end of the line if it isn't present + normal! { + call search('|') + execute 'silent .,''}s/\v([^\|])\|?(\s{0,})$/\1|\2/e' + endif + normal! { " Search instead of `normal! j` because of the table at beginning of file edge case. call search('|') @@@ -462,11 -564,11 +564,11 @@@ let l:flags = (&gdefault ? '' : 'g') execute 's/\(:\@' endif endfunction endif @@@ -666,7 -773,7 +773,7 @@@ if !get(g:, 'vim_markdown_no_default_ke call MapNotHasmapto('][', 'Markdown_MoveToNextSiblingHeader') call MapNotHasmapto('[]', 'Markdown_MoveToPreviousSiblingHeader') call MapNotHasmapto(']u', 'Markdown_MoveToParentHeader') - call MapNotHasmapto(']c', 'Markdown_MoveToCurHeader') + call MapNotHasmapto(']h', 'Markdown_MoveToCurHeader') call MapNotHasmapto('gx', 'Markdown_OpenUrlUnderCursor') call MapNotHasmapto('ge', 'Markdown_EditUrlUnderCursor') endif @@@ -674,18 -781,20 +781,20 @@@ command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(, ) command! -buffer -range=% HeaderIncrease call s:HeaderDecrease(, , 1) command! -buffer -range=% SetexToAtx call s:SetexToAtx(, ) - command! -buffer TableFormat call s:TableFormat() + command! -buffer -range TableFormat call s:TableFormat() command! -buffer Toc call s:Toc() command! -buffer Toch call s:Toc('horizontal') command! -buffer Tocv call s:Toc('vertical') command! -buffer Toct call s:Toc('tab') + command! -buffer -nargs=? InsertToc call s:InsertToc('bullets', ) + command! -buffer -nargs=? InsertNToc call s:InsertToc('numbers', ) " Heavily based on vim-notes - http://peterodding.com/code/vim/notes/ if exists('g:vim_markdown_fenced_languages') let s:filetype_dict = {} for s:filetype in g:vim_markdown_fenced_languages - let key = matchstr(s:filetype, "[^=]*") - let val = matchstr(s:filetype, "[^=]*$") + let key = matchstr(s:filetype, '[^=]*') + let val = matchstr(s:filetype, '[^=]*$') let s:filetype_dict[key] = val endfor else @@@ -702,8 -811,8 +811,8 @@@ function! s:MarkdownHighlightSources(fo " Look for code blocks in the current file let filetypes = {} for line in getline(1, '$') - let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*') - if !empty(ft) && ft !~ '^\d*$' | let filetypes[ft] = 1 | endif + let ft = matchstr(line, '\(`\{3,}\|\~\{3,}\)\s*\zs[0-9A-Za-z_+-]*\ze.*') + if !empty(ft) && ft !~# '^\d*$' | let filetypes[ft] = 1 | endif endfor if !exists('b:mkd_known_filetypes') let b:mkd_known_filetypes = {} @@@ -726,15 -835,17 +835,17 @@@ else let filetype = ft endif - let group = 'mkdSnippet' . toupper(substitute(filetype, "[+-]", "_", "g")) + let group = 'mkdSnippet' . toupper(substitute(filetype, '[+-]', '_', 'g')) if !has_key(b:mkd_included_filetypes, filetype) let include = s:SyntaxInclude(filetype) let b:mkd_included_filetypes[filetype] = 1 else let include = '@' . toupper(filetype) endif - let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s' - execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '') + let command_backtick = 'syntax region %s matchgroup=%s start="^\s*`\{3,}\s*%s.*$" matchgroup=%s end="\s*`\{3,}$" keepend contains=%s%s' + let command_tilde = 'syntax region %s matchgroup=%s start="^\s*\~\{3,}\s*%s.*$" matchgroup=%s end="\s*\~\{3,}$" keepend contains=%s%s' + execute printf(command_backtick, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '') + execute printf(command_tilde, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '') execute printf('syntax cluster mkdNonListItem add=%s', group) let b:mkd_known_filetypes[ft] = 1 @@@ -766,15 -877,23 +877,23 @@@ function! s:SyntaxInclude(filetype return grouplistname endfunction + function! s:IsHighlightSourcesEnabledForBuffer() + " Enable for markdown buffers, and for liquid buffers with markdown format + return &filetype =~# 'markdown' || get(b:, 'liquid_subtype', '') =~# 'markdown' + endfunction function! s:MarkdownRefreshSyntax(force) - if &filetype =~ 'markdown' && line('$') > 1 + " Use != to compare &syntax's value to use the same logic run on + " $VIMRUNTIME/syntax/synload.vim. + " + " vint: next-line -ProhibitEqualTildeOperator + if s:IsHighlightSourcesEnabledForBuffer() && line('$') > 1 && &syntax != 'OFF' call s:MarkdownHighlightSources(a:force) endif endfunction function! s:MarkdownClearSyntaxVariables() - if &filetype =~ 'markdown' + if s:IsHighlightSourcesEnabledForBuffer() unlet! b:mkd_included_filetypes endif endfunction diff --combined .vim/bundle/vim-markdown/indent/markdown.vim index 2fa4cda8,a954c923..a954c923 --- a/.vim/bundle/vim-markdown/indent/markdown.vim +++ b/.vim/bundle/vim-markdown/indent/markdown.vim @@@ -1,4 -1,4 +1,4 @@@ - if exists("b:did_indent") | finish | endif + if exists('b:did_indent') | finish | endif let b:did_indent = 1 setlocal indentexpr=GetMarkdownIndent() @@@ -8,7 -8,7 +8,7 @@@ setlocal autoinden " Automatically continue blockquote on line break setlocal formatoptions+=r setlocal comments=b:> - if get(g:, "vim_markdown_auto_insert_bullets", 1) + if get(g:, 'vim_markdown_auto_insert_bullets', 1) " Do not automatically insert bullets when auto-wrapping with text-width setlocal formatoptions-=c " Accept various markers as bullets @@@ -16,24 -16,24 +16,24 @@@ endif " Only define the function once - if exists("*GetMarkdownIndent") | finish | endif + if exists('*GetMarkdownIndent') | finish | endif function! s:IsMkdCode(lnum) let name = synIDattr(synID(a:lnum, 1, 0), 'name') - return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)') + return (name =~# '^mkd\%(Code$\|Snippet\)' || name !=# '' && name !~? '^\%(mkd\|html\)') endfunction function! s:IsLiStart(line) - return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' && - \ a:line =~ '^\s*[*+-] \+' + return a:line !~# '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' && + \ a:line =~# '^\s*[*+-] \+' endfunction function! s:IsHeaderLine(line) - return a:line =~ '^\s*#' + return a:line =~# '^\s*#' endfunction function! s:IsBlankLine(line) - return a:line =~ '^$' + return a:line =~# '^$' endfunction function! s:PrevNonBlank(lnum) @@@ -48,7 -48,7 +48,7 @@@ function GetMarkdownIndent( if v:lnum > 2 && s:IsBlankLine(getline(v:lnum - 1)) && s:IsBlankLine(getline(v:lnum - 2)) return 0 endif - let list_ind = get(g:, "vim_markdown_new_list_item_indent", 4) + let list_ind = get(g:, 'vim_markdown_new_list_item_indent', 4) " Find a non-blank line above the current line. let lnum = s:PrevNonBlank(v:lnum - 1) " At the start of the file use zero indent. diff --combined .vim/bundle/vim-markdown/syntax/markdown.vim index c1a2b2ca,07ae0a8a..07ae0a8a --- a/.vim/bundle/vim-markdown/syntax/markdown.vim +++ b/.vim/bundle/vim-markdown/syntax/markdown.vim @@@ -7,7 -7,7 +7,7 @@@ " Read the HTML syntax to start with - if version < 600 + if v:version < 600 so :p:h/html.vim else runtime! syntax/html.vim @@@ -17,14 -17,14 +17,14 @@@ endif endif - if version < 600 + if v:version < 600 syntax clear - elseif exists("b:current_syntax") + elseif exists('b:current_syntax') finish endif " don't use standard HiLink, it will not work with included syntax files - if version < 508 + if v:version < 508 command! -nargs=+ HtmlHiLink hi link else command! -nargs=+ HtmlHiLink hi def link @@@ -70,10 -70,10 +70,10 @@@ execute 'syn region mkdLink matchgroup= " Autolink without angle brackets. " mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment " ------------ _____________________ ----------------------------- _________________________ ----------------- __ - syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/ + syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?[^] \t]*/ " Autolink with parenthesis. - syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*)\)\@=" end=")" + syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?[^] \t]*)\)\@=" end=")" " Autolink with angle brackets. syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@ ]*>" end=">" @@@ -86,14 -86,14 +86,14 @@@ syn region mkdLinkTitle matchgroup=mkdD syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained "HTML headings - syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell - syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell - syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell + syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=@mkdHeadingContent,@Spell + syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=@mkdHeadingContent,@Spell + syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=@mkdHeadingContent,@Spell + syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=@mkdHeadingContent,@Spell + syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=@mkdHeadingContent,@Spell + syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=@mkdHeadingContent,@Spell + syn match htmlH1 /^.\+\n=\+$/ contains=@mkdHeadingContent,@Spell + syn match htmlH2 /^.\+\n-\+$/ contains=@mkdHeadingContent,@Spell "define Markdown groups syn match mkdLineBreak / \+$/ @@@ -103,14 -103,15 +103,15 @@@ execute 'syn region mkdCode matchgroup= execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealcode execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@]*\\\@" end=""' . s:concealcode - execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\\\@" end=""' . s:concealcode + execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\)\\\@" end=""' . s:concealcode + execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\)\\\@" end=""' . s:concealcode syn region mkdFootnote start="\[^" end="\]" syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/ syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained - syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained - syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell + syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained nextgroup=mkdListItemCheckbox + syn match mkdListItemCheckbox /\[[xXoO ]\]\ze\s\+/ contained contains=mkdListItem + syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,mkdListItemCheckbox,@Spell syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*\(\*\|\s\)*$/ syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-\(-\|\s\)*$/ @@@ -155,30 -156,32 +156,32 @@@ if get(g:, 'vim_markdown_strikethrough' HtmlHiLink mkdStrike htmlStrike endif + syn cluster mkdHeadingContent contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdLink,mkdInlineURL,mkdStrike,mkdCode syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath,mkdStrike "highlighting for Markdown groups - HtmlHiLink mkdString String - HtmlHiLink mkdCode String - HtmlHiLink mkdCodeDelimiter String - HtmlHiLink mkdCodeStart String - HtmlHiLink mkdCodeEnd String - HtmlHiLink mkdFootnote Comment - HtmlHiLink mkdBlockquote Comment - HtmlHiLink mkdListItem Identifier - HtmlHiLink mkdRule Identifier - HtmlHiLink mkdLineBreak Visual - HtmlHiLink mkdFootnotes htmlLink - HtmlHiLink mkdLink htmlLink - HtmlHiLink mkdURL htmlString - HtmlHiLink mkdInlineURL htmlLink - HtmlHiLink mkdID Identifier - HtmlHiLink mkdLinkDef mkdID - HtmlHiLink mkdLinkDefTarget mkdURL - HtmlHiLink mkdLinkTitle htmlString - HtmlHiLink mkdDelimiter Delimiter - - let b:current_syntax = "mkd" + HtmlHiLink mkdString String + HtmlHiLink mkdCode String + HtmlHiLink mkdCodeDelimiter String + HtmlHiLink mkdCodeStart String + HtmlHiLink mkdCodeEnd String + HtmlHiLink mkdFootnote Comment + HtmlHiLink mkdBlockquote Comment + HtmlHiLink mkdListItem Identifier + HtmlHiLink mkdListItemCheckbox Identifier + HtmlHiLink mkdRule Identifier + HtmlHiLink mkdLineBreak Visual + HtmlHiLink mkdFootnotes htmlLink + HtmlHiLink mkdLink htmlLink + HtmlHiLink mkdURL htmlString + HtmlHiLink mkdInlineURL htmlLink + HtmlHiLink mkdID Identifier + HtmlHiLink mkdLinkDef mkdID + HtmlHiLink mkdLinkDefTarget mkdURL + HtmlHiLink mkdLinkTitle htmlString + HtmlHiLink mkdDelimiter Delimiter + + let b:current_syntax = 'mkd' delcommand HtmlHiLink " vim: ts=8 diff --combined .vim/bundle/vim-markdown/test/folding-toc.vader index 79c54001,8d688f77..8d688f77 --- a/.vim/bundle/vim-markdown/test/folding-toc.vader +++ b/.vim/bundle/vim-markdown/test/folding-toc.vader @@@ -2,6 -2,7 +2,7 @@@ Before: source ../after/ftplugin/markdown.vim + setlocal foldtext=foldtext() After: setlocal foldexpr=0 @@@ -120,28 -121,28 +121,28 @@@ Execute (check TOC) let res = getloclist(0) let elem = res[0] AssertEqual elem.lnum, 1 - AssertEqual elem.text, '# chap 1' + AssertEqual elem.text, 'chap 1' let elem = res[1] AssertEqual elem.lnum, 15 - AssertEqual elem.text, '## chap 1.1' + AssertEqual elem.text, ' chap 1.1' let elem = res[2] AssertEqual elem.lnum, 25 - AssertEqual elem.text, '### chap 1.1.1' + AssertEqual elem.text, ' chap 1.1.1' let elem = res[3] AssertEqual elem.lnum, 30 - AssertEqual elem.text, '# chap 2' + AssertEqual elem.text, 'chap 2' let elem = res[4] AssertEqual elem.lnum, 34 - AssertEqual elem.text, '## chap 2.1' + AssertEqual elem.text, ' chap 2.1' let elem = res[5] AssertEqual elem.lnum, 41 - AssertEqual elem.text, '# chap 3' + AssertEqual elem.text, 'chap 3' let elem = res[6] AssertEqual elem.lnum, 45 AssertEqual elem.text, 'chap 4' let elem = res[7] AssertEqual elem.lnum, 50 - AssertEqual elem.text, 'chap 4.1' + AssertEqual elem.text, ' chap 4.1' Given markdown; --- @@@ -174,5 -175,5 +175,5 @@@ Execute (check Toc of yaml front matter AssertEqual len(res), 1 let elem = res[0] AssertEqual elem.lnum, 8 - AssertEqual elem.text, 'heading' + AssertEqual elem.text, ' heading' unlet g:vim_markdown_frontmatter diff --combined .vim/bundle/vim-markdown/test/header-decrease.vader index 00000000,4fa58ef6..4fa58ef6 mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/test/header-decrease.vader +++ b/.vim/bundle/vim-markdown/test/header-decrease.vader @@@ -1,0 -1,116 +1,116 @@@ + Given markdown; + # a + + ## b + + ### c + + #### d + + ##### e + + Execute (HeaderIncrease without forbidden level): + :HeaderIncrease + + Expect (increase level of all headers): + ## a + + ### b + + #### c + + ##### d + + ###### e + + Given markdown; + # a + + ###### b + + Execute (HeaderIncrease with forbidden level): + :HeaderIncrease + + Expect (no changes): + # a + + ###### b + + Given markdown; + ## a + + ### b + + #### c + + ##### d + + ###### e + + Execute (HeaderDecrease without forbidden level): + :HeaderDecrease + + Expect (decrease level of all headers): + # a + + ## b + + ### c + + #### d + + ##### e + + Given markdown; + # a + + ## b + + ### c + + #### d + + ##### e + + ###### f + + Execute (HeaderDecrease with forbidden level): + :HeaderDecrease + + Expect (no changes): + # a + + ## b + + ### c + + #### d + + ##### e + + ###### f + + Given markdown; + a + = + + b + - + + Execute (HeaderIncrease with setext headers): + :HeaderIncrease + + Expect (convert to atx headers): + ## a + + ### b + + Given markdown; + a + - + + Execute (HeaderDecrease with setext headers): + :HeaderDecrease + + Expect (convert to atx headers): + # a diff --combined .vim/bundle/vim-markdown/test/insert-toc.vader index 00000000,b8d669bc..b8d669bc mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/test/insert-toc.vader +++ b/.vim/bundle/vim-markdown/test/insert-toc.vader @@@ -1,0 -1,147 +1,147 @@@ + Given markdown; + # a + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + + Execute (InsertToc format): + :2 + :call append('.', '') + :InsertToc + + Expect (format): + # a + + * [Foo Level 2](#foo-level-2) + * [Foo Level 3](#foo-level-3) + * [Foo Level 4](#foo-level-4) + * [Bar Level 2](#bar-level-2) + * [Bar Level 3](#bar-level-3) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + + Given markdown; + # a + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + + Execute (InsertToc only h2 headers): + :2 + :call append('.', '') + :InsertToc 2 + + Expect (only h2 headers): + # a + + * [Foo Level 2](#foo-level-2) + * [Bar Level 2](#bar-level-2) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + + Given markdown; + # a + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ## Baz Level 2 + + ## Foobar Level 2 + + ## Foobaz Level 2 + + ## Barfoo Level 2 + + ## Barbaz Level 2 + + ## Bazfoo Level 2 + + ## Bazbar Level 2 + + ## Foobarbaz Level 2 + + Execute (InsertNToc format, and up to h3 headers): + :2 + :call append('.', '') + :InsertNToc 3 + + Expect (format, and up to h3 headers): + # a + + 1. [Foo Level 2](#foo-level-2) + * [Foo Level 3](#foo-level-3) + 2. [Bar Level 2](#bar-level-2) + 3. [Baz Level 2](#baz-level-2) + 4. [Foobar Level 2](#foobar-level-2) + 5. [Foobaz Level 2](#foobaz-level-2) + 6. [Barfoo Level 2](#barfoo-level-2) + 7. [Barbaz Level 2](#barbaz-level-2) + 8. [Bazfoo Level 2](#bazfoo-level-2) + 9. [Bazbar Level 2](#bazbar-level-2) + 10. [Foobarbaz Level 2](#foobarbaz-level-2) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ## Baz Level 2 + + ## Foobar Level 2 + + ## Foobaz Level 2 + + ## Barfoo Level 2 + + ## Barbaz Level 2 + + ## Bazfoo Level 2 + + ## Bazbar Level 2 + + ## Foobarbaz Level 2 diff --combined .vim/bundle/vim-markdown/test/map.vader index 7ecdfad1,57fe6190..57fe6190 --- a/.vim/bundle/vim-markdown/test/map.vader +++ b/.vim/bundle/vim-markdown/test/map.vader @@@ -146,8 -146,8 +146,8 @@@ Given markdown b - Execute (]c): + Execute (]h): normal! 3G AssertEqual line('.'), 3 - normal ]c + normal ]h AssertEqual line('.'), 1 diff --combined .vim/bundle/vim-markdown/test/setextoatx.vader index 00000000,a27938fa..a27938fa mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/test/setextoatx.vader +++ b/.vim/bundle/vim-markdown/test/setextoatx.vader @@@ -1,0 -1,48 +1,48 @@@ + Given markdown; + # a + + a + = + + ## b + + b + - + + Execute (SetexToAtx): + :SetexToAtx + + Expect (convert setex-style headings to atx): + # a + + # a + + ## b + + ## b + + Given markdown; + a + = + + b + = + + c + - + + d + - + + Execute (SetexToAtx with range): + :1,8SetexToAtx + + Expect (only convert setex headings in original range): + # a + + # b + + ## c + + d + - diff --combined .vim/bundle/vim-markdown/test/strikethrough.vader index 00000000,4fe392ab..4fe392ab mode 000000,100644..100644 --- a/.vim/bundle/vim-markdown/test/strikethrough.vader +++ b/.vim/bundle/vim-markdown/test/strikethrough.vader @@@ -1,0 -1,41 +1,41 @@@ + Before: + let g:vim_markdown_strikethrough = 1 + syn off | syn on + + After: + unlet! g:vim_markdown_strikethrough + + Given markdown; + a ~~b~~ c + + Execute (strikethrough): + AssertNotEqual SyntaxOf('a'), 'mkdStrike' + AssertEqual SyntaxOf('b'), 'mkdStrike' + AssertNotEqual SyntaxOf('c'), 'mkdStrike' + + Given markdown; + # ~~h1~~ + ## ~~h2~~ + ### ~~h3~~ + #### ~~h4~~ + ##### ~~h5~~ + ###### ~~h6~~ + + Execute (strikethrough in atx headings): + AssertEqual SyntaxOf('h1'), 'mkdStrike' + AssertEqual SyntaxOf('h2'), 'mkdStrike' + AssertEqual SyntaxOf('h3'), 'mkdStrike' + AssertEqual SyntaxOf('h4'), 'mkdStrike' + AssertEqual SyntaxOf('h5'), 'mkdStrike' + AssertEqual SyntaxOf('h6'), 'mkdStrike' + + Given markdown; + ~~h1~~ + = + + ~~h2~~ + - + + Execute (strikethrough in setext headings): + AssertEqual SyntaxOf('h1'), 'mkdStrike' + AssertEqual SyntaxOf('h2'), 'mkdStrike' diff --combined .vim/bundle/vim-markdown/test/syntax.md index 33f5500e,9c89e3f6..9c89e3f6 --- a/.vim/bundle/vim-markdown/test/syntax.md +++ b/.vim/bundle/vim-markdown/test/syntax.md @@@ -31,7 -31,7 +31,7 @@@ en [a]( b "c" ) - a (`a`) b. Fix: + a (`a`) b. Fix: Escaped: diff --combined .vim/bundle/vim-markdown/test/syntax.vader index 5ce94fc2,b111de0d..b111de0d --- a/.vim/bundle/vim-markdown/test/syntax.vader +++ b/.vim/bundle/vim-markdown/test/syntax.vader @@@ -2,6 -2,7 +2,7 @@@ Before unlet! b:mkd_known_filetypes unlet! b:mkd_included_filetypes unlet! g:vim_markdown_math + unlet! b:liquid_subtype Given markdown; a **b** c @@@ -634,7 -635,8 +635,8 @@@ Given markdown Execute (link with url title): AssertEqual SyntaxOf('https://domain.tld'), 'mkdInlineURL' - AssertEqual SyntaxOf('https://domain.com'), 'mkdInlineURL' + AssertNotEqual SyntaxOf(']'), 'mkdInlineURL' + AssertEqual SyntaxOf('https://domain.com'), 'mkdURL' AssertNotEqual SyntaxOf('not_a_link'), 'mkdInlineURL' # Code Blocks @@@ -738,12 -740,18 +740,18 @@@ def end ``` + ```ruby {linenos=table,hl_lines=[8,"15-17"],linenostart=199} + class b + end + ``` + Execute (fenced code block syntax with a language specifier): let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax') call b:func(0) AssertEqual SyntaxOf('include'), 'cInclude' AssertEqual SyntaxOf('code'), 'mkdSnippetCPP' AssertEqual SyntaxOf('def'), 'rubyDefine' + AssertEqual SyntaxOf('class'), 'rubyClass' Given markdown; ``` c++ @@@ -848,6 -856,17 +856,17 @@@ Execute (fenced code block with extended info strings): AssertEqual SyntaxOf('a'), 'mkdCode' + Given liquid; + ```vim + let g:a = 1 + ``` + + Execute (fenced code block syntax in liquid file with markdown subtype): + let b:liquid_subtype = 'markdown' + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax') + call b:func(0) + AssertEqual SyntaxOf('g:a'), 'vimVar' + # Code Blocks in pre and code tag Given markdown; @@@ -957,12 -976,12 +976,12 @@@ $$ \frac{a}{b} $ Execute (math tex highlighting): let g:vim_markdown_math=0 syn off | syn on - AssertNotEqual SyntaxOf('sqrt'), 'texStatement' - AssertNotEqual SyntaxOf('frac'), 'texStatement' + AssertNotEqual SyntaxOf('sqrt')[0:2], 'tex' + AssertNotEqual SyntaxOf('frac')[0:2], 'tex' let g:vim_markdown_math=1 syn off | syn on - AssertEqual SyntaxOf('sqrt'), 'texStatement' - AssertEqual SyntaxOf('frac'), 'texStatement' + AssertEqual SyntaxOf('sqrt')[0:2], 'tex' + AssertEqual SyntaxOf('frac')[0:2], 'tex' Given markdown; $a b[$ c @@@ -985,7 -1004,7 +1004,7 @@@ Execute (math ends with $$) AssertNotEqual SyntaxOf('c')[0:2], 'tex' Given markdown; - $(0 \le 1)$ + $(0 \leq 1)$ Execute (math conceal in $): if has('conceal') @@@ -996,20 -1015,21 +1015,21 @@@ AssertEqual synconcealed(1, 2)[0], 0 AssertEqual synconcealed(1, 3)[0], 0 AssertEqual synconcealed(1, 4)[0], 0 - AssertEqual synconcealed(1, 5)[0], 1, '\le' + AssertEqual synconcealed(1, 5)[0], 1, '\leq' AssertEqual synconcealed(1, 6)[0], 1 AssertEqual synconcealed(1, 7)[0], 1 - AssertEqual synconcealed(1, 8)[0], 0 + AssertEqual synconcealed(1, 8)[0], 1 AssertEqual synconcealed(1, 9)[0], 0 AssertEqual synconcealed(1, 10)[0], 0 - AssertEqual synconcealed(1, 11)[0], 1, '$' + AssertEqual synconcealed(1, 11)[0], 0 + AssertEqual synconcealed(1, 12)[0], 1, '$' setlocal conceallevel=0 endif Given markdown; $$ \omega - 0 \le 1 + 0 \leq 1 $$ Execute (math conceal in $$): @@@ -1020,8 -1040,8 +1040,8 @@@ AssertEqual synconcealed(1, 1)[0], 1, '$$' AssertEqual synconcealed(2, 1)[0], 1, '\omega' AssertEqual synconcealed(3, 1)[0], 0, '0' - AssertEqual synconcealed(3, 3)[0], 1, '\le' - AssertEqual synconcealed(3, 7)[0], 0, '1' + AssertEqual synconcealed(3, 3)[0], 1, '\leq' + AssertEqual synconcealed(3, 8)[0], 0, '1' AssertEqual synconcealed(4, 1)[0], 1, '$$' setlocal conceallevel=0 endif @@@ -1282,3 -1302,227 +1302,227 @@@ Execute (HTML tag in text) AssertEqual SyntaxOf('span'), 'htmlTagName' AssertEqual SyntaxOf(''), 'htmlTag' AssertEqual SyntaxOf(''), 'htmlEndTag' + + Given markdown; + # _h1_ + + ## _h2_ + + ### _h3_ + + #### _h4_ + + ##### _h5_ + + ###### _h6_ + + Execute (underscore italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + AssertEqual SyntaxOf('h3'), 'htmlItalic' + AssertEqual SyntaxOf('h4'), 'htmlItalic' + AssertEqual SyntaxOf('h5'), 'htmlItalic' + AssertEqual SyntaxOf('h6'), 'htmlItalic' + + Given markdown; + # *h1* + + ## *h2* + + ### *h3* + + #### *h4* + + ##### *h5* + + ###### *h6* + + Execute (asterisk italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + AssertEqual SyntaxOf('h3'), 'htmlItalic' + AssertEqual SyntaxOf('h4'), 'htmlItalic' + AssertEqual SyntaxOf('h5'), 'htmlItalic' + AssertEqual SyntaxOf('h6'), 'htmlItalic' + + Given markdown; + _h1_ + = + + _h2_ + - + + Execute (underscore italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + + Given markdown; + *h1* + = + + *h2* + - + + Execute (asterisk italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + + Given markdown; + # __h1__ + + ## __h2__ + + ### __h3__ + + #### __h4__ + + ##### __h5__ + + ###### __h6__ + + Execute (underscore bold text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + AssertEqual SyntaxOf('h3'), 'htmlBold' + AssertEqual SyntaxOf('h4'), 'htmlBold' + AssertEqual SyntaxOf('h5'), 'htmlBold' + AssertEqual SyntaxOf('h6'), 'htmlBold' + + Given markdown; + # **h1** + + ## **h2** + + ### **h3** + + #### **h4** + + ##### **h5** + + ###### **h6** + + Execute (asterisk bold text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + AssertEqual SyntaxOf('h3'), 'htmlBold' + AssertEqual SyntaxOf('h4'), 'htmlBold' + AssertEqual SyntaxOf('h5'), 'htmlBold' + AssertEqual SyntaxOf('h6'), 'htmlBold' + + Given markdown; + __h1__ + = + + __h2__ + - + + Execute (underscore bold text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + + Given markdown; + **h1** + = + + **h2** + - + + Execute (asterisk bold text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + + Given markdown; + # ___h1___ + + ## ___h2___ + + ### ___h3___ + + #### ___h4___ + + ##### ___h5___ + + ###### ___h6___ + + Execute (underscore bold italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h3'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h4'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h5'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h6'), 'htmlBoldItalic' + + Given markdown; + # ***h1*** + + ## ***h2*** + + ### ***h3*** + + #### ***h4*** + + ##### ***h5*** + + ###### ***h6*** + + Execute (asterisk bold italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h3'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h4'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h5'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h6'), 'htmlBoldItalic' + + Given markdown; + ___h1___ + = + + ___h2___ + - + + Execute (underscore bold italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + + Given markdown; + ***h1*** + = + + ***h2*** + - + + Execute (asterisk bold italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + + Given markdown; + # [^h1] + + ## [^h2] + + ### [^h3] + + #### [^h4] + + ##### [^h5] + + ###### [^h6] + + Execute (footnotes in atx headings): + AssertEqual SyntaxOf('h1'), 'mkdFootnotes' + AssertEqual SyntaxOf('h2'), 'mkdFootnotes' + AssertEqual SyntaxOf('h3'), 'mkdFootnotes' + AssertEqual SyntaxOf('h4'), 'mkdFootnotes' + AssertEqual SyntaxOf('h5'), 'mkdFootnotes' + AssertEqual SyntaxOf('h6'), 'mkdFootnotes' + + Given markdown; + [^h1] + = + + [^h2] + - + + Execute (footnotes in setext headings): + AssertEqual SyntaxOf('h1'), 'mkdFootnotes' + AssertEqual SyntaxOf('h2'), 'mkdFootnotes' diff --combined .vim/bundle/vim-markdown/test/table-format.vader index 2fc06a39,f7028cb0..f7028cb0 --- a/.vim/bundle/vim-markdown/test/table-format.vader +++ b/.vim/bundle/vim-markdown/test/table-format.vader @@@ -30,6 -30,19 +30,19 @@@ Expect (table is not modified) |---|---| | c | d | + Given markdown (indented table); + | a | b | + |---|---| + | c | d | + + Execute (format well formatted, indented table): + TableFormat + + Expect (table is not modified): + | a | b | + |---|---| + | c | d | + Given markdown; | left |right| center || | :- | --: |:---:|:| @@@ -42,3 -55,31 +55,31 @@@ Expect (preserve colons to align text) | left | right | center | | |:-----|------:|:------:|:--| | left | right | center | | + + Given markdown (indented table with colons); + | left |right| center || + | :- | --: |:---:|:| + | left |right| center || + + Execute (format indented table with colons): + TableFormat + + Expect (preserve colons to align text): + | left | right | center | | + |:-----|------:|:------:|:--| + | left | right | center | | + + Given markdown (borderless table); + left |right| center + :- | --: |:---: + left |right| center + + Execute (format borderless table): + let g:vim_markdown_borderless_table = 1 + TableFormat + unlet g:vim_markdown_borderless_table + + Expect (table with borders): + | left | right | center | + |:-----|------:|:------:| + | left | right | center | diff --combined .vim/bundle/vim-markdown/test/vimrc index 638ab3f7,84a85b09..84a85b09 --- a/.vim/bundle/vim-markdown/test/vimrc +++ b/.vim/bundle/vim-markdown/test/vimrc @@@ -1,16 -1,17 +1,17 @@@ set nocompatible - set rtp+=../ - set rtp+=../build/tabular/ - set rtp+=../build/vim-toml/ - set rtp+=../build/vim-json/ - set rtp+=../build/vader.vim/ - set rtp-=~/.vim - set rtp-=~/.vim/after + let $LANG='en_US' + + filetype off + set runtimepath+=../ + set runtimepath+=../build/tabular/ + set runtimepath+=../build/vim-toml/ + set runtimepath+=../build/vim-json/ + set runtimepath+=../build/vader.vim/ filetype on - filetype plugin on - filetype indent on - syntax on + + filetype plugin indent on + syntax enable function! Markdown_GetScriptID(fname) abort let l:snlist = '' @@@ -24,6 -25,7 +25,7 @@@ endif endfor endfunction + function! Markdown_GetFunc(fname, funcname) abort return function('' . Markdown_GetScriptID(a:fname) . '_' . a:funcname) endfunction