From 75f7a834db274cffea839cdf8f4293ffbb389cea Mon Sep 17 00:00:00 2001 From: rwxrob Date: Mon, 27 Jan 2020 09:30:43 -0500 Subject: [PATCH 1/9] smart squotes and apostrophe --- doc/pandoc-syntax.txt | 2 ++ syntax/pandoc.vim | 34 ++++++++++++++++++----- tests/smart.pdc | 63 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 tests/smart.pdc 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/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/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 From 1f9d9f38b65dd872b61ee4b14be9c9fbd406093c Mon Sep 17 00:00:00 2001 From: rwxrob Date: Sat, 1 Feb 2020 15:36:20 -0500 Subject: [PATCH 2/9] added quotes and apostrophe to blockquotes --- syntax/pandoc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim index 3dba88d..8047f5d 100644 --- a/syntax/pandoc.vim +++ b/syntax/pandoc.vim @@ -273,7 +273,7 @@ syn match pandocTitleBlockTitle /\%^%.*\n/ contained containedin=pandocTitleBloc " }}}2 " Blockquotes: {{{2 -syn match pandocBlockQuote /^\s\{,3}>.*\n\(.*\n\@1.*\n\(.*\n\@1/ contained containedin=pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted " }}}2 From ef1b34874fd9323a0e3dc03468520ea66ffc824a Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 16:12:34 -0500 Subject: [PATCH 3/9] readme updates for forked --- LICENSE | 21 ------------------ README.md | 65 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 50 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a543e10..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013-2019 vim-pandoc-syntax contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index e3fa606..ee97d8c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -# vim-pandoc-syntax +# Vim Syntax for Simplified Pandoc -[![Vint](https://github.com/vim-pandoc/vim-pandoc-syntax/workflows/Vint/badge.svg)](https://github.com/vim-pandoc/vim-pandoc-syntax/actions?workflow=Vint) +[![Vint](https://github.com/rwxrob/vim-pandoc-syntax-ez/workflows/Vint/badge.svg)](https://github.com/rwxrob/vim-pandoc-syntax-ez/actions?workflow=Vint) -Standalone pandoc syntax module, to be used alongside -[vim-pandoc](http://github.com/vim-pandoc/vim-pandoc). +The `vim-pandoc-simple-syntax` standalone Pandoc syntax module is a fork from the [vim-pandoc/vim-pandoc-syntax](https://github.com/vim-pandoc/vim-pandoc-syntax): -Forked from the version provided by `fmoralesc/vim-pantondoc`, in turn taken -from `vim-pandoc/vim-pandoc`. +* Corrects faults in highlighting and smart punctuation +* Adds opinionated color settings +* Removes many confusing default conceals +* Removes (and flags) common departures from Simplified Pandoc ## Requirements @@ -16,40 +17,36 @@ 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. +Add something like the following to your `.vimrc` after installing the [`Plug`](https://github.com/junegunn/vim-plug) Vim package manager (all the others are rather dated and don't allow storing plugins separated): -For Vundle users, it should be enough to add - Plugin 'vim-pandoc/vim-pandoc-syntax' - -to `.vimrc`, and then run `:PluginInstall`. - -For those who need it, a tarball is available from -[here](https://github.com/vim-pandoc/vim-pandoc-syntax/archive/master.zip). +``` +call plug#begin('~/.vimplugins') +Plug 'vim-pandoc/vim-pandoc' +Plug 'rwxrob/vim-pandoc-syntax-simple' +call plug#end() +``` ### 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: +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`) + +* 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). + +* Configurable (see `:help pandoc-syntax-configuration` for an overview of the options). ## Screenshots @@ -57,3 +54,13 @@ Vim to load it for certain files. Just add something like this to your vimrc: ![img2](http://i.imgur.com/z8FpxRP.png) ![img3](http://i.imgur.com/ziNjQiE.png) ![img4](http://i.imgur.com/UKoOxzP.png) + +## TODO + +* ***Remove*** conceal ligatures for section and lists. +* Correct syntax highlighting of Pandoc Tables. +* Integrated better defaults colors. +* Consider adding themes for better color customization. +* Add ellipsis smart punctuation from list context. +* Other stuff ... + From 01f50483c0034a2996280d3bced9f67c5c8fc901 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 16:50:06 -0500 Subject: [PATCH 4/9] ellipsis fix started en em --- README.md | 2 +- syntax/pandoc.vim | 14 +++++++------- tests/smart.pdc | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ee97d8c..e632b69 100644 --- a/README.md +++ b/README.md @@ -62,5 +62,5 @@ augroup END * Integrated better defaults colors. * Consider adding themes for better color customization. * Add ellipsis smart punctuation from list context. +* Correct en-dash and em-dash missing contexts. * Other stuff ... - diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim index 8047f5d..445361a 100644 --- a/syntax/pandoc.vim +++ b/syntax/pandoc.vim @@ -3,12 +3,12 @@ scriptencoding utf-8 " " Vim syntax file " -" Language: Pandoc (superset of Markdown) -" Maintainer: Felipe Morales -" Maintainer: Caleb Maclennan +" Language: Simplified Pandoc (superset of Markdown) +" Maintainer: Rob Muhlestein (twitch.tv/rwxrob) +" Contributor: Felipe Morales +" Contributor: Caleb Maclennan " Contributor: David Sanson " Contributor: Jorge Israel Peña -" Contributor: Rob Muhlestein (twitch.tv/rwxrob) " OriginalAuthor: Jeremy Schultz " Version: 5.1 @@ -509,19 +509,19 @@ endif " Emdashes: {{{3 if &encoding ==# 'utf-8' - call s:WithConceal('emdashes', 'syn match pandocEllipses /\([^-]\)\@<=---\([^-]\)\@=/ display', 'conceal cchar=—') + call s:WithConceal('emdashes', 'syn match pandocEmdashes /---/ containedin=pandocSetexHeader,pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=—') endif " }}}3 " Endashes: {{{3 if &encoding ==# 'utf-8' - call s:WithConceal('endashes', 'syn match pandocEllipses /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=–') + call s:WithConceal('endashes', 'syn match pandocEndashes /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=–') endif " }}}3 " Ellipses: {{{3 if &encoding ==# 'utf-8' - call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ display', 'conceal cchar=…') + call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=…') endif " }}}3 diff --git a/tests/smart.pdc b/tests/smart.pdc index 3c04dc8..71a43d3 100644 --- a/tests/smart.pdc +++ b/tests/smart.pdc @@ -1,4 +1,4 @@ -# smart punctuation +# Smart Punctuation # Ellipses ... @@ -15,6 +15,38 @@ Blah ... blah. ... and yet. ...and yet. +* I'm in a bullet... + +Endash -- +---------- + +Endash -- +========== + +And then there was -- + +Blah--blah. +Blah -- blah. + +-- and yet. +--and yet. + +* I'm in a bullet... + +Emdash --- +--------- + +Emdash --- +========== + +And then there was --- + +Blah---blah. +Blah --- blah. + +--- and yet. +---and yet. + # "Foo" is a thing A "Foo" is a thing From fb9479ee71c75bd32d482ba0e0bd3ffcf45e3c40 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 16:51:44 -0500 Subject: [PATCH 5/9] nixed screenshots --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index e632b69..a9bb642 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,10 @@ augroup END * 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) - ## TODO * ***Remove*** conceal ligatures for section and lists. +* Add back screenshots (from imgur to keep plugin light). * Correct syntax highlighting of Pandoc Tables. * Integrated better defaults colors. * Consider adding themes for better color customization. From f08d1fe730112db7ed124f6978f721822dbc85b9 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 16:52:30 -0500 Subject: [PATCH 6/9] vim syntax for Plug --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9bb642..e5f993b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The `vim-pandoc-simple-syntax` standalone Pandoc syntax module is a fork from th Add something like the following to your `.vimrc` after installing the [`Plug`](https://github.com/junegunn/vim-plug) Vim package manager (all the others are rather dated and don't allow storing plugins separated): -``` +```vim call plug#begin('~/.vimplugins') Plug 'vim-pandoc/vim-pandoc' Plug 'rwxrob/vim-pandoc-syntax-simple' From 203ca037d59f504545cb135d7b334e9cd0ec173e Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 16:53:50 -0500 Subject: [PATCH 7/9] fixed vint --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5f993b..e765a57 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Vim Syntax for Simplified Pandoc -[![Vint](https://github.com/rwxrob/vim-pandoc-syntax-ez/workflows/Vint/badge.svg)](https://github.com/rwxrob/vim-pandoc-syntax-ez/actions?workflow=Vint) +[![Vint](https://github.com/rwxrob/vim-pandoc-syntax-simple/workflows/Vint/badge.svg)](https://github.com/rwxrob/vim-pandoc-syntax-simple/actions?workflow=Vint) The `vim-pandoc-simple-syntax` standalone Pandoc syntax module is a fork from the [vim-pandoc/vim-pandoc-syntax](https://github.com/vim-pandoc/vim-pandoc-syntax): From 82c0165ec821484a78fcc7acfca36a587ca09248 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 17:32:31 -0500 Subject: [PATCH 8/9] die die die stupid wasteful action --- .github/workflows/vint.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/vint.yml diff --git a/.github/workflows/vint.yml b/.github/workflows/vint.yml deleted file mode 100644 index 4f0ff7e..0000000 --- a/.github/workflows/vint.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Vint -on: [push, pull_request] -jobs: - vint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Setup dependencies - run: pip install vim-vint - - name: Run Vimscript Linter - run: vint . From 7e430a688d2d4e2b42d200b6de5fceb94c5bf78b Mon Sep 17 00:00:00 2001 From: rwxrob Date: Thu, 13 Feb 2020 17:53:24 -0500 Subject: [PATCH 9/9] fuck vint --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e765a57..686a7e3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Vim Syntax for Simplified Pandoc -[![Vint](https://github.com/rwxrob/vim-pandoc-syntax-simple/workflows/Vint/badge.svg)](https://github.com/rwxrob/vim-pandoc-syntax-simple/actions?workflow=Vint) - The `vim-pandoc-simple-syntax` standalone Pandoc syntax module is a fork from the [vim-pandoc/vim-pandoc-syntax](https://github.com/vim-pandoc/vim-pandoc-syntax): * Corrects faults in highlighting and smart punctuation