]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge pull request #125 from cirosantilli/remove-useless-line
authorCiro Santilli <ciro.santilli@gmail.com>
Mon, 29 Sep 2014 07:42:27 +0000 (09:42 +0200)
committerCiro Santilli <ciro.santilli@gmail.com>
Mon, 29 Sep 2014 07:42:27 +0000 (09:42 +0200)
Remove useless line in Toc funciton.

.travis.yml [new file with mode: 0644]
CONTRIBUTING.md
README.md
syntax/mkd.vim
test/README.md [new file with mode: 0644]
test/run-tests.sh [new file with mode: 0755]
test/syntax.md
test/syntax.vader [new file with mode: 0644]
test/vimrc [new file with mode: 0644]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..12bf12e
--- /dev/null
@@ -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
index 7a603db37fee283d38461892640cebab5c8f0880..b29b8cc752ff828929801ea386f082b132355daf 100644 (file)
@@ -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.
index 18044db9d042181c4871062592ec5f78936dfefa..6755e94762864b0c6c3a40eb61929a4c12879ad7 100644 (file)
--- 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:
index 4677f6546f6b428b9d46fc6d6c5386fe9005ad01..19d59d56ab230ea54dcb3e12ec7b30ccb783ca82 100644 (file)
@@ -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="\\\@<!\$" end="\$"
+  syn region mkdMath matchgroup=mkdDelimiter start="\\\@<!\$\$" end="\$\$"
+endif
+
+syn cluster mkdNonListItem contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdID,mkdURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdMath,mkdIndentCode,mkdListItem,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
 
 "highlighting for Markdown groups
 HtmlHiLink mkdString       String
@@ -114,7 +119,7 @@ HtmlHiLink mkdID            Identifier
 HtmlHiLink mkdLinkDef       mkdID
 HtmlHiLink mkdLinkDefTarget mkdURL
 HtmlHiLink mkdLinkTitle     htmlString
-
+HtmlHiLink mkdMath          Statement
 HtmlHiLink mkdDelimiter     Delimiter
 
 " Automatically insert bullets
diff --git a/test/README.md b/test/README.md
new file mode 100644 (file)
index 0000000..1817e55
--- /dev/null
@@ -0,0 +1,7 @@
+To run the tests, you must install [Vader](https://github.com/junegunn/vader.vim).
+
+Vader and other plugins must be installed in the same directory as this repository.
+
+Run the tests with:
+
+    ./run-tests.sh
diff --git a/test/run-tests.sh b/test/run-tests.sh
new file mode 100755 (executable)
index 0000000..c8c6213
--- /dev/null
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+cd "$( dirname "${BASH_SOURCE[0]}" )" && vim -Nu vimrc -c 'Vader! *' > /dev/null
index 22f3b1a541ed6f0bf28c435aa812cab0522a5b90..d031c2f745c2ca45e64208a63588177c958b7a33 100644 (file)
@@ -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: <https://github.com/plasticboy/vim-markdown/issues/113>
+
+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 (file)
index 0000000..6d51118
--- /dev/null
@@ -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 (file)
index 0000000..86020ed
--- /dev/null
@@ -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