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

@ -1,6 +1,8 @@
# VimwikiTOC {{{1
#
# TODO implement: If link in the heading (see README.md)
# Just generate the TOC
# See: link_* for link movement and creation
#
# TODO (10min) test if g:vimwiki_to_header well readen
# TODO (10min) test vimviki_toc_link_format
# TODO (1h) test if really wiki dependant (for 2 diffrent wikis)
@ -28,6 +30,30 @@
#
# Start {{{1
Given vimwiki (With link header (#182) {{{1):
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Execute (VimwikiTOC: Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect vimwiki (With link header (#182) {{{1):
# Contents
- [A link B](#a-link-b)
- [tlink](#tlink)
- [7.4.1528](#741528)
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Given vimwiki (Underline header (SetExt) (#209) {{{1):
First with spaces