Skip to content

feature: Allow delimiting YAML metadata blocks with three dots at the bottom #195

@urosmikanovic

Description

@urosmikanovic

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

The grammar models the rules for YAML metadata blocks incorrectly as it does not detect the bottom delimiter of the blocks as allowed by one of the established markdown flavors and defined by the YAML spec.

Describe the solution you'd like

Pandoc allows for YAML metadata blocks to be delimited with three dots at the bottom:

A YAML metadata block is a valid YAML object, delimited by a line of three hyphens (---) at the top and a line of three hyphens (---) or three dots (...) at the bottom. The initial line --- must not be followed by a blank line. A YAML metadata block may occur anywhere in the document, but if it is not at the beginning, it must be preceded by a blank line.1

(Pandoc-flavored markdown also allows for the block(s!) to occur anywhere, see #76 )

This is also in line with YAML spec:

YAML uses three dashes (“---”) to separate directives from document content. This also serves to signal the start of a document if no directives are present. Three dots ( “...”) indicate the end of a document without starting a new one, for use in communication channels.2

Describe alternatives you've considered

Using markdown.vim syntax highlights.

Additional context

No response

Footnotes

  1. https://pandoc.org/MANUAL.html#extension-yaml_metadata_block

  2. https://yaml.org/spec/1.2.2/#structures

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions