From: Ciro Santilli Date: Mon, 29 Sep 2014 07:42:27 +0000 (+0200) Subject: Merge pull request #125 from cirosantilli/remove-useless-line X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/c0ddc5537f3f023228a36cae9da0f2b3d81702b0?hp=ec849b08fe403dba226248ff01c04a67e53fed41 Merge pull request #125 from cirosantilli/remove-useless-line Remove useless line in Toc funciton. --- diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..12bf12e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: vim + +install: | + sudo apt-get update + sudo apt-get install vim + cd .. + git clone https://github.com/godlygeek/tabular + git clone https://github.com/junegunn/vader.vim + +script: | + cd "$TRAVIS_BUILD_DIR" + ./test/run-tests.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a603db..b29b8cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,12 +36,4 @@ If you wish to have a behavior that differs from that style guide, add an option # Tests -All new features must have tests. We don't require unit tests: tests that require users to open markdown code in Vim and check things manually are accepted, but you should point clearly to where the tests are. - -Wherever possible, use test cases from the [karlcow's Markdown Test Suite](https://github.com/karlcow/markdown-testsuite), and link to the relevant test files on your merge request. - -If a test does not exist there yet, make a pull request to them, and link to that pull request on the pull request you make here. - -If the test you want to do is not appropriate for the Markdown Test Suite, create it only under the `test/` directory here. - -If we start disagreeing too often on what is appropriate or not, we will fork off that repository. +All new features must have unit tests. diff --git a/README.md b/README.md index 18044db..6755e94 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Markdown Vim Mode +[![Build Status](https://travis-ci.org/plasticboy/vim-markdown.svg)](https://travis-ci.org/plasticboy/vim-markdown) + Syntax highlighting, matching rules and mappings for [the original Markdown](http://daringfireball.net/projects/markdown/) and extensions. ## Installation @@ -59,6 +61,15 @@ Add the following line to your `.vimrc` to disable default key mappings. You can let g:vim_markdown_no_default_key_mappings=1 ``` +**Syntax extensions** + +The following options control which syntax extensions will be turned on. + +LaTeX math: `$ $`, `$$ $$`, escapable as `\$ \$` and `\$\$ \$\$`: + +```vim +let g:vim_markdown_math=1 +``` ## Mappings The following work on normal and visual modes: diff --git a/syntax/mkd.vim b/syntax/mkd.vim index 4677f65..19d59d5 100644 --- a/syntax/mkd.vim +++ b/syntax/mkd.vim @@ -94,7 +94,12 @@ syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contain syn match htmlH1 /^.\+\n=\+$/ contains=@Spell syn match htmlH2 /^.\+\n-\+$/ contains=@Spell -syn cluster mkdNonListItem contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdID,mkdURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdIndentCode,mkdListItem,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6 +if get(g:, 'vim_markdown_math', 0) + syn region mkdMath matchgroup=mkdDelimiter start="\\\@ /dev/null diff --git a/test/syntax.md b/test/syntax.md index 22f3b1a..d031c2f 100644 --- a/test/syntax.md +++ b/test/syntax.md @@ -15,3 +15,75 @@ def f 0 end ``` + +# Links + +[a](b "c") + +[a]() + +[good spell](a) + +[badd spell](a) + +[a](b "c") + +[a]( b +"c" ) + +a (`a`) b. Fix: + +Escaped: + +\[a](b) + +[a\]b](c) + +## Known failures + +Escape does not work: + +[a\](b) + +Should not be links because of whitespace: + +[a] (b) + +[a](a +b) + +[a](a b) + +# Reference links + +Single links: + +[a][b] + +[good spell][a] + +[badd spell][a] + +[a][] + +[a] [] + +[a][b] c [d][e] + +Reference link followed by inline link: + +[a] [b](c) + +## Known failures + +Should be shortcut reference links: + +[a] + +[a] b [c] + +Should be a single link: + +[a] [b] + +[a] b [c](d) diff --git a/test/syntax.vader b/test/syntax.vader new file mode 100644 index 0000000..6d51118 --- /dev/null +++ b/test/syntax.vader @@ -0,0 +1,74 @@ +Given mkd (bold); +**bold** not bold + +Execute (SyntaxOf(pattern)): + AssertEqual SyntaxOf('b'), 'htmlBold' + +Given mkd (italic); +*italic* + +Execute (SyntaxOf(pattern)): + AssertEqual SyntaxOf('i'), 'htmlItalic' + +# Links + +Given mkd; +[a](b) + +Execute (link with title): + AssertEqual SyntaxOf('a'), 'mkdLink' + AssertEqual SyntaxOf('b'), 'mkdURL' + +Given mkd; +(a) + +Execute (parenthesis not in link): + AssertNotEqual SyntaxOf('a'), 'mkdLink' + +Given mkd; +[a](b) c [d](e) + +Execute (multiple links on a line): + AssertEqual SyntaxOf('c'), '' + +# Math + +Given mkd; +a $x$ b +c $$y$$ d +\$e\$ +\$\$f\$\$ + +Execute (math): + AssertNotEqual SyntaxOf('x'), 'mkdMath' + AssertNotEqual SyntaxOf('y'), 'mkdMath' + let g:vim_markdown_math=1 + syn off | syn on + AssertNotEqual SyntaxOf('a'), 'mkdMath' + AssertNotEqual SyntaxOf('b'), 'mkdMath' + AssertNotEqual SyntaxOf('c'), 'mkdMath' + AssertNotEqual SyntaxOf('d'), 'mkdMath' + AssertNotEqual SyntaxOf('e'), 'mkdMath' + AssertNotEqual SyntaxOf('f'), 'mkdMath' + AssertEqual SyntaxOf('x'), 'mkdMath' + AssertEqual SyntaxOf('y'), 'mkdMath' + let g:vim_markdown_math=0 + syn off | syn on + AssertNotEqual SyntaxOf('x'), 'mkdMath' + AssertNotEqual SyntaxOf('y'), 'mkdMath' + +Given mkd; +a + +$ +b +$ + +c + +Execute (multiline math): + let g:vim_markdown_math=1 + syn off | syn on + AssertNotEqual SyntaxOf('a'), 'mkdMath' + AssertEqual SyntaxOf('b'), 'mkdMath' + AssertNotEqual SyntaxOf('c'), 'mkdMath' diff --git a/test/vimrc b/test/vimrc new file mode 100644 index 0000000..86020ed --- /dev/null +++ b/test/vimrc @@ -0,0 +1,8 @@ +set nocompatible +set rtp+=../ +set rtp+=../../tabular/ +set rtp+=../../vader.vim/ +filetype on +filetype plugin on +filetype indent on +syntax on