diff --git a/README.md b/README.md index e3fa606..67e9b81 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ Standalone pandoc syntax module, to be used alongside [vim-pandoc](http://github.com/vim-pandoc/vim-pandoc). -Forked from the version provided by `fmoralesc/vim-pantondoc`, in turn taken -from `vim-pandoc/vim-pandoc`. +Forked from the version provided by `fmoralesc/vim-pantondoc`, in turn taken from `vim-pandoc/vim-pandoc`. ## Requirements @@ -16,44 +15,52 @@ from `vim-pandoc/vim-pandoc`. ## Installation -The repository follows the usual bundle structure, so it's easy to install it -using [pathogen](https://github.com/tpope/vim-pathogen), -[Vundle](https://github.com/gmarik/vundle) or NeoBundle. +The repository follows the usual bundle structure, so it's easy to install it using [Plug](https://github.com/junegunn/vim-plug), [pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/gmarik/vundle) or NeoBundle. -For Vundle users, it should be enough to add +**Plug** adds something like the following lines to `.vimrc`: - Plugin 'vim-pandoc/vim-pandoc-syntax' +```vim +Plug 'vim-pandoc/vim-pandoc-syntax' +``` -to `.vimrc`, and then run `:PluginInstall`. +**Vundle** users should add: -For those who need it, a tarball is available from -[here](https://github.com/vim-pandoc/vim-pandoc-syntax/archive/master.zip). +```vim +Plugin 'vim-pandoc/vim-pandoc-syntax' +``` + +Run `:PluginInstall` after making the changes from within a `vim` session, or you can just run `vim +':PlugInstall' +':q!' +':q!'` from the command line. + +A [tarball](https://github.com/vim-pandoc/vim-pandoc-syntax/archive/master.zip) is also available. ### Standalone If you want to use `vim-pandoc-syntax` without vim-pandoc, you'll need to tell Vim to load it for certain files. Just add something like this to your vimrc: -~~~ vim - augroup pandoc_syntax - au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc - augroup END -~~~ +```vim +augroup pandoc_syntax + au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc +augroup END +``` ## Features -* Supports most (if not all) pandoc's markdown features, including tables, +* Supports most (if not all) Pandoc's markdown features, including tables, delimited codeblocks, references, etc. + * Can handle multiple embedded languages (LaTeX, YAML headers, many languages in delimited codeblocks). Some commands are provided to help with this (see `:help pandoc-syntax-commands`) + * Pretty display using `conceal` (optional). + * Configurable (see `:help pandoc-syntax-configuration` for an overview of the options). ## Screenshots -![img1](http://i.imgur.com/UKXbG2V.png) -![img2](http://i.imgur.com/z8FpxRP.png) -![img3](http://i.imgur.com/ziNjQiE.png) -![img4](http://i.imgur.com/UKoOxzP.png) +![img1](doc/UKXbG2V.png) +![img2](doc/z8FpxRP.png) +![img3](doc/ziNjQiE.png) +![img4](doc/UKoOxzP.png) diff --git a/doc/UKXbG2V.png b/doc/UKXbG2V.png new file mode 100644 index 0000000..5d04599 Binary files /dev/null and b/doc/UKXbG2V.png differ diff --git a/doc/UKoOxzP.png b/doc/UKoOxzP.png new file mode 100644 index 0000000..512fa3b Binary files /dev/null and b/doc/UKoOxzP.png differ diff --git a/doc/pandoc-syntax.txt b/doc/pandoc-syntax.txt index 325b483..7a6069b 100644 --- a/doc/pandoc-syntax.txt +++ b/doc/pandoc-syntax.txt @@ -37,6 +37,8 @@ CONFIGURATION *vim-pandoc-syntax-configuration* - dashes - ellipses - quotes + - squotes + - apostrophe - inlinecode To review what are the rules for, look for the call to |s:WithConceal| in diff --git a/doc/z8FpxRP.png b/doc/z8FpxRP.png new file mode 100644 index 0000000..0d0a248 Binary files /dev/null and b/doc/z8FpxRP.png differ diff --git a/doc/ziNjQiE.png b/doc/ziNjQiE.png new file mode 100644 index 0000000..26b5a73 Binary files /dev/null and b/doc/ziNjQiE.png differ diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim index 0e09029..3dba88d 100644 --- a/syntax/pandoc.vim +++ b/syntax/pandoc.vim @@ -8,8 +8,9 @@ scriptencoding utf-8 " Maintainer: Caleb Maclennan " Contributor: David Sanson " Contributor: Jorge Israel Peña +" Contributor: Rob Muhlestein (twitch.tv/rwxrob) " OriginalAuthor: Jeremy Schultz -" Version: 5.0 +" Version: 5.1 " Configuration: {{{1 " @@ -223,6 +224,14 @@ endif " Syntax Rules: {{{1 +" corrects distracting conceal (ligature) background colors, blue makes +" it obvious that the character is a ligature instead of an actual Unicode +" character since both can exist in the same file +hi Conceal ctermbg=none ctermfg=Blue + +" preferable link color to underlining +hi link pandocDelimitedCodeBlock pandocNoFormatted + " Embeds: {{{2 " HTML: {{{3 @@ -368,11 +377,11 @@ call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained " }}}2 " Headers: {{{2 -syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display +syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display syn match pandocAtxHeaderMark /\(^#\{1,6}\|\\\@[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=”') endif " }}}3 +" +" Apostrophes: {{{3 +if &encoding ==# 'utf-8' + call s:WithConceal('apostrophes', 'syn match pandocApostrophe /[*~_\n[:space:]]\@[[:punct:]]*\)\@<=''[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=’') +endif +" }}}3 " Hrule: {{{3 syn match pandocHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display diff --git a/tests/block.pdc b/tests/block.pdc index 5a82e52..f273689 100644 --- a/tests/block.pdc +++ b/tests/block.pdc @@ -106,14 +106,3 @@ hello 1) a 2) b -# smart punctuation - -ellipses: .... -quote "signs". This only works at the beggining and end of words. -quote "signs." - -issue #31: - -"Foo" -*"Foo"* -**"Foo"** diff --git a/tests/smart.pdc b/tests/smart.pdc new file mode 100644 index 0000000..3c04dc8 --- /dev/null +++ b/tests/smart.pdc @@ -0,0 +1,63 @@ +# smart punctuation + +# Ellipses ... + +Ellipses ... +---------- + +Ellipses ... +========== + +And then there was ... + +Blah ... blah. + +... and yet. +...and yet. + +# "Foo" is a thing + +A "Foo" is a thing +------------------ + +A "Foo" is a thing +================== + +Just some "foo" here. +Are you a "foo"? + +"Foo" +*"Foo"* +**"Foo"** +_"Foo"_ +__"Foo"__ +~~"Foo"~~ + +# 'Bar' + +'Bar' +----- + +'Bar' +===== + +Just some 'bar' here. +Are you a 'bar'? + +'Bar' +*'Bar'* +**'Bar'** +_'Bar'_ +__'Bar'__ +~~'Bar'~~ + +# I'd Really Like to Know + +I'd Really Like to Know +----------------------- + +I'd Really Like to Know +======================= + +I'd +'cuz