Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown header / frontmatter #92

Open
skwde opened this issue Feb 15, 2022 · 0 comments
Open

Markdown header / frontmatter #92

skwde opened this issue Feb 15, 2022 · 0 comments

Comments

@skwde
Copy link

skwde commented Feb 15, 2022

Description

In vim-header when editing markdown files the header automatically uses a code block.
I never saw this type of header in markdown files. Is there a reason for it?

I think it is more common to have a yaml front matter as e.g. used by Hugo.

At least this should be optional I think. This would also only need a minimal change to your code.

Proposals

  1. Change the comment string from code block to yaml in autoload/header.vim, i.e. use ---.

  2. If the code block header is a general default (I don't know about) we can at least make the yaml frontmatter optional by introducing a new variable

    ; toggle front matter format as yaml
    let g:header_markdown_yaml_format = 1

    then in autoload/header.vim we set the default

    if !exists('g:header_markdown_yaml_format')
        let g:header_markdown_yaml_format = 0
    endif

    and only add to the markdown elseif after the default stuff

    if g:header_markdown_yaml_format == 1
        let b:comment_begin = '---'
        let b:comment_end = '---'
    endif

    The changes to your code are minimal to support yaml front matter

Bottom Line

I currently use my 1. proposal locally, but would also be willing to implement the 2. one.

Let me know what you think / prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant