-
Notifications
You must be signed in to change notification settings - Fork 62
multiple smart punctuation fixes #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
 | ||
 | ||
 | ||
 | ||
 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please revert these changes and drop the image blobs from the commit(s)? For now I think I'd rather leave these out-of-band. One you put screenshots in a plugin they follow the repository around literally forever, and if you update them people start having multiple versions of the images in their repositories. Given that I check out my plugins on all sorts of machines, that starts adding up space and bandwidth for very little gain. |
||
 | ||
 | ||
 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ scriptencoding utf-8 | |
" Maintainer: Caleb Maclennan <[email protected]> | ||
" Contributor: David Sanson <[email protected]> | ||
" Contributor: Jorge Israel Peña <[email protected]> | ||
" Contributor: Rob Muhlestein (twitch.tv/rwxrob) <[email protected]> | ||
" OriginalAuthor: Jeremy Schultz <[email protected]> | ||
" 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}\|\\\@<!#\+\(\s*.*$\)\@=\)/ contained containedin=pandocAtxHeader | ||
call s:WithConceal('atx', 'syn match pandocAtxStart /#/ contained containedin=pandocAtxHeaderMark', 'conceal cchar='.s:cchars['atx']) | ||
syn match pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape | ||
syn match pandocSetexHeader /^.\+\n[-]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape | ||
syn match pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@Spell,pandocAmpersandEscape | ||
syn match pandocSetexHeader /^.\+\n[-]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@Spell,pandocAmpersandEscape | ||
syn match pandocHeaderAttr /{.*}/ contained containedin=pandocAtxHeader,pandocSetexHeader | ||
syn match pandocHeaderID /#[-_:.[:lower:][:upper:]]*/ contained containedin=pandocHeaderAttr | ||
" }}}2 | ||
|
@@ -452,12 +461,12 @@ call s:WithConceal('abbrev', 'syn match pandocAbbreviationTail /\]/ contained co | |
syn match pandocFootnoteID /\[\^[^\]]\+\]/ nextgroup=pandocFootnoteDef | ||
|
||
" Inline footnotes | ||
syn region pandocFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocStrongEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocEllipses,pandocBeginQuote,pandocEndQuote,@Spell,pandocAmpersandEscape skipnl keepend | ||
syn region pandocFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocStrongEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,@Spell,pandocAmpersandEscape skipnl keepend | ||
call s:WithConceal('footnote', 'syn match pandocFootnoteDefHead /\^\[/ contained containedin=pandocFootnoteDef', 'conceal cchar='.s:cchars['footnote']) | ||
call s:WithConceal('footnote', 'syn match pandocFootnoteDefTail /\]/ contained containedin=pandocFootnoteDef', 'conceal') | ||
|
||
" regular footnotes | ||
syn region pandocFootnoteBlock start=/\[\^.\{-}\]:\s*\n*/ end=/^\n^\s\@!/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocNewLine,pandocStrongEmphasis,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion,pandocAmpersandEscape,@Spell skipnl | ||
syn region pandocFootnoteBlock start=/\[\^.\{-}\]:\s*\n*/ end=/^\n^\s\@!/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocNewLine,pandocStrongEmphasis,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostophe,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion,pandocAmpersandEscape,@Spell skipnl | ||
syn match pandocFootnoteBlockSeparator /:/ contained containedin=pandocFootnoteBlock | ||
syn match pandocFootnoteID /\[\^.\{-}\]/ contained containedin=pandocFootnoteBlock | ||
call s:WithConceal('footnote', 'syn match pandocFootnoteIDHead /\[\^/ contained containedin=pandocFootnoteID', 'conceal cchar='.s:cchars['footnote']) | ||
|
@@ -522,6 +531,19 @@ if &encoding ==# 'utf-8' | |
call s:WithConceal('quotes', 'syn match pandocEndQuote /\(\>[[: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:]]\@<!''/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=’') | ||
endif | ||
" }}}3 | ||
|
||
" Single Quotes: {{{3 | ||
if &encoding ==# 'utf-8' | ||
call s:WithConceal('squotes', 'syn match pandocBeginSQuote /[_*\n[:space:]]\@<=''\</ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=‘') | ||
call s:WithConceal('squotes', 'syn match pandocEndSQuote /\(\>[[: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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.