Fix: VimwikiTOC is broken against headers with link (Issue #182)

Problem: VimwikiTOC and follow_link do not support header (anchor) with
link in their body

Solution:
- VimwikiTOC (easy): Create function base.vim s:clean_header_text that
converts [DESC](URL) -> DESC
- follow_link (hard):
-- [[URL]]: was already working due to punctuation removal.
-- [DESC](URL): Search for a potential `]([^)]*)` after every character
This commit is contained in:
Tinmarino
2020-08-05 22:26:05 -04:00
parent e4186adc3d
commit 69ead3bf3c
7 changed files with 160 additions and 24 deletions

View File

@ -900,14 +900,14 @@ function! s:populate_extra_markdown_vars() abort
let rxWeblink1Ext = '__FileExtension__'
endif
" [DESCRIPTION](URL)
" [DESCRIPTION](FILE.MD)
let mkd_syntax.Weblink1Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. rxWeblink1Ext.
\ mkd_syntax.rxWeblink1Suffix
" [DESCRIPTION](ANCHOR)
" [DESCRIPTION](FILE)
let mkd_syntax.Weblink2Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Suffix
" [DESCRIPTION](FILE#ANCHOR)
" [DESCRIPTION](FILE.MD#ANCHOR)
let mkd_syntax.Weblink3Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. rxWeblink1Ext.
\ '#__LinkAnchor__'. mkd_syntax.rxWeblink1Suffix