Skip to content

Markdown header / frontmatter #92

@skwde

Description

@skwde

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions