Description
I proposed skipping frontmatter areas in #3031 as a temporary solution.
It is not ideal. I would like to introduce Frontmatter parser and run as a guest of the Markdown parser.
I wouldn't say this is a major topic, but a very interesting topic.
In a markdown file, the frontmatter represented at least 3 ways.
---
frontmatter in yaml
---
;;;
frontmatter in JSON without top level { and } pair
;;;
+++
frontmatter in TOML
+++
Base on the above notation, the markdown parser may schedule running YAML, JSON, or TOML parser as a guest.
Ideal Frontmatter parser runs as a sub parser of YAML, JSON, and/or TOML.
When I designed the sub parser mechanism, I assumed a sub parser might have multiple base parsers.
I implemented the mechanism with the assumption. However, I have no chance to test the implementation.
Is this written in the standard markdown syntax?
No it's not markdown, it's it's frontmatter language yaml. Special information(meta data) used by static site generators like hugo and how you mentioned jekyll. Pandoc, vuepress and many other's use it. This is extra information that is needed to create html documents.
Your default markdown.ctags ignores it because it does not match the patterns.
Could you tell me a web page where the syntax is explained?
You found it that's a good example.
This is an example template:
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: false
tags: ['code','{{.Name}}']
menu:
main:
parent: 'code'
---
Then this would be created:
---
title: "Example"
date: 2021-05-17T23:20:21-05:00
draft: false
tags: ['code','example']
menu:
main:
parent: 'code'
---
## Introduction
Markdown starts here.
I want to fix the markdown parser of ctags not to make the tag for "parent: 'code'".
I agree the command ctags/ctags --options=NONE --options=mymd.ctags --extras=+'{pseudo}' --fields=+'{extras}' -o - input.md
should not be capturing the front matter tags, it should ignore front matter, anything
in between the 3 dashes---
.
I already have another tags file that I create that captures the frontmatter (the 'code' and 'example' tags).
frontmatter.ctags
--langdef=frontmatter
--map-frontmatter=+.md
--kinddef-frontmatter=t,tags,front matter tags
--_tabledef-frontmatter=toplevel
--_tabledef-frontmatter=tag
--_mtable-regex-frontmatter=toplevel/\ntags:[ \t]*\[[ ]?['"]//{tenter=tag}
--_mtable-regex-frontmatter=toplevel/.//
--_mtable-regex-frontmatter=tag/([a-zA-Z0-9]+)/\1/t/
--_mtable-regex-frontmatter=tag/['"]\]//{tquit}
--_mtable-regex-frontmatter=tag/.//
--exclude=.git
--exclude=vim.md
Originally posted by @rickalex21 in #3027 (comment)