mirror of
https://github.com/vim/vim
synced 2025-07-15 16:51:57 +00:00
patch 9.1.1537: helptoc: still some issues when markdown code blocks
Problem: helptoc: still some issues when parsing markdown code blocks (VimWei) Solution: assign nextline to curline before starting the next loop iteration; when processing fenced code blocks, flip the skip_fence variable, update the test to be more comprehensive related: https://github.com/vim/vim/issues/17699#issuecomment-3055603968 closes: #17716 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -3,7 +3,7 @@ vim9script noclear
|
||||
# the Vim HelpTOC plugin, creates a table of contents in a popup
|
||||
# Maintainer: Vim project
|
||||
# Original Author: @lacygoill
|
||||
# Latest Change: 2025 Jul 09
|
||||
# Latest Change: 2025 Jul 10
|
||||
#
|
||||
# Config {{{1
|
||||
# g:helptoc {{{2
|
||||
@ -523,12 +523,14 @@ def SetToc() #{{{2
|
||||
|
||||
# Special handling for markdown filetype using setext headings
|
||||
if g:helptoc.type == 'markdown'
|
||||
# ignore fenced codeblock lines
|
||||
if curline =~ '^```.'
|
||||
skip_fence = true
|
||||
elseif curline =~ '^```$'
|
||||
skip_fence = false
|
||||
skip_fence = !skip_fence
|
||||
endif
|
||||
if skip_fence
|
||||
curline = nextline
|
||||
continue
|
||||
endif
|
||||
# Check for setext formatted headings (= or - underlined)
|
||||
|
Reference in New Issue
Block a user