taskwiki
taskwiki copied to clipboard
Viewports for markdown violate markdown lint MD022
MD022 - Headings should be surrounded by blank lines
Since the regexp for VIEWPORT['markdown']
requires "Header beginning" (Note, this is also a typo).
VIEWPORT = {
'default':
re.compile(
r'^' # Starts at the begging of the line
r'[=]+' # Heading begging
r'(?P<name>[^=\|\[\{]*)' # Name of the viewport, all before the | sign
# Cannot include '[', '=', '|', and '{'
r'\|' # Bar
r'(?!\|)' # (But not two, that would be a preset)
r'(?P<filter>[^=\|]*?)' # Filter
r'(' # Optional defaults
r'\|' # Bar
r'(?P<defaults>[^=\|]+?)' # Default attrs
r')?'
r'\s*' # Any whitespace
r'(#(?P<source>[A-Z]))?' # Optional source indicator
r'\s*' # Any whitespace
r'(\$(?P<sort>[A-Z]))?' # Optional sort indicator
r'\s*' # Any whitespace
r'[=]+' # Header ending
),
'markdown':
re.compile(
r'^' # Starts at the begging of the line
r'[#]+' # Heading begging
r'(?P<name>[^#\|\[\{]*)' # Name of the viewport, all before the | sign
# Cannot include '[', '#', '|', and '{'
r'\|' # Bar
r'(?!\|)' # (But not two, that would be a preset)
r'(?P<filter>[^#\|]*?)' # Filter
r'(' # Optional defaults
r'\|' # Bar
r'(?P<defaults>[^#\|]+?)' # Default attrs
r')?'
r'\s*' # Any whitespace
r'(#(?P<source>[A-Z]))?' # Optional source indicator
r'\s*' # Any whitespace
r'(\$(?P<sort>[A-Z]))?' # Optional sort indicator
r'\s*' # Any whitespace
r'$' # End of line
)
}
@NGenetzky do I understand correctly that adding a blank line below the viewport's heading (between the heading and the list of tasks) would suffice?
@tbabej , yes I believe that is all that is necessary.
@NGenetzky do I understand correctly that adding a blank line below the viewport's heading (between the heading and the list of tasks) would suffice?
This should solve one of the problems you run into when autoformatting markdown-files in vim
e.g. via pandoc FILE.md -t markdown_strict
or prettier FILE.md
(I guess there are many other ways).
taskwiki seems to behave strangely when blank line(s) are added between the viewport header and an existing task list: it inserts a second copy of the list instead of updating it. The parser should perhaps be more tolerant and accept any number of blank lines under the viewport header.
For reference, vimwiki inserts a blank line between headers and automatically
generated blocks (TOC, tag list, link list) when using Markdown. This is set
through g:vimwiki_markdown_header_style
, which defaults to 1
blank line.
Taskwiki should probably use that setting when inserting or updating a list.