Feature: Markdown: Support SetExt Heading (Issue #209)

Like these
==========

See: https://spec.commonmark.org/0.29/#setext-headings

Note: work for follow_link and VimwikiTOC
This commit is contained in:
Tinmarino
2020-08-04 00:44:01 -04:00
parent 40f02293bf
commit fc056cfeca
8 changed files with 202 additions and 26 deletions

View File

@ -10,7 +10,7 @@
# -- 2. remove anything that is not a letter, number, space or hyphen (see the source for how Unicode is handled) => from 'bad characters'
# -- 3. changes any space to a hyphen => OK: from previous big
# -- 4. If that is not unique, add "-1", "-2", "-3",... to make it unique => TODO not implemented
#
#
#
# TODO if link in heading
#Given vimwiki (Two same heading {{{1):
@ -29,6 +29,60 @@
# Start {{{1
Given vimwiki (Underline header (SetExt) (#209) {{{1):
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Heading SetExt created):
# Contents
- [First with spaces](#first-with-spaces)
- [Second](#second)
- [Third](#third)
- [Four](#four)
- [Last](#last)
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Given vimwiki (Two same heading (#968) {{{1):
# One
@ -69,10 +123,10 @@ Execute (Set syntax markdown && VimwikiTOC):
Expect (Bad characters are removed):
# Contents
- [One !@#@#(!%#&$^(!@](#one-)
- [Two !!~!!:"@!>@!>?<](#two-)
# One !@#@#(!%#&$^(!@
## Two !!~!!:"@!>@!>?<

View File

@ -1,8 +1,58 @@
# Link internal to a file
# See issue #666 for anchor support (then internal links)
# Preambule set file onces and for all {{{1
# Otherwise the bash script is freezing
Given vimwiki (a):
a
Execute (Set filename wiki_test.md):
file wiki_test.md
# Link to anchor with spaces {{{!
Expect (a):
a
# Link to anchor in SetExt {{{1
# Like that
# -----
# Issue: #209
Given vimwiki (Anchor SetExt):
[jump](#frst-one)
F!rst One
=========
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Enter link):
\<Cr>
A__HERE__\<Esc>
Expect (Cursor jumped SetExt):
[jump](#frst-one)
F!rst One__HERE__
=========
Given vimwiki (Bad Anchor SetExt):
[jump](#frst-one)
F!rst One
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Enter link):
\<Cr>
A__HERE__\<Esc>
Expect (Cursor stayed (not jumped) SetExt):
[jump](#frst-one)__HERE__
F!rst One
# Link to anchor with spaces {{{1
# PR #840
# Issues: #831
@ -10,12 +60,11 @@ Given vimwiki (Internal links zith spaces):
[Any ! apparent name @#$](#basic-heading-many-spaces)
One line here
## Basic HeAding Many SpacES
## Basic HeAding Many SpacES
One line here
Execute (Set filename wiki_test.md):
file wiki_test.md
call SetSyntax('markdown')
Do (Enter link):
@ -26,7 +75,7 @@ Expect (Cursor at heading position):
[Any ! apparent name @#$](#basic-heading-many-spaces)
One line here
## Basic HeAding Many SpacES__HERE__
## Basic HeAding Many SpacES__HERE__
One line here

View File

@ -328,6 +328,20 @@ Execute (Assert Syntax link):
# 3 Header {{{1
###############
Given vimwiki (Markdown SetExt Headers):
One
===
two
---
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax Header SetExt):
AssertEqual 'VimwikiHeader1', SyntaxAt(1, 1)
AssertEqual 'VimwikiHeader1', SyntaxAt(2, 1)
AssertEqual 'VimwikiHeader2', SyntaxAt(3, 1)
AssertEqual 'VimwikiHeader2', SyntaxAt(4, 1)
Given vimwiki (Wiki Headers):
= Header level 1 =