Skip to content

Changed frontmatter filtering to support YAML, JSON, TOML, and arbitrary languages

What does this MR do?

Adds support for rendering other languages beyond YAML in Markdown front matter. Explicit support for TOML and JSON is added with common delimiter markers. Status of support can be demonstrated on GitLab.com here: https://gitlab.com/travismiller/gitlab-frontmatter

  • YAML Delimiter --- already supported
  • TOML Delimiter +++
  • JSON Delimiter ;;;
  • JSON Without Delimiter
  • Arbitrary language ---php, +++python, ;;;python

YAML

---
example:
  language: yaml
---
example:
  language: yaml

TOML

+++
[example]
language = 'toml'
+++
[example]
language = 'toml'

JSON

;;;
{
  "example": {
    "language": "json"
  }
}
;;;
{
  "example": {
    "language": "json"
  }
}

Arbitrary

Support other languages by adding a specifier to any of the existing delimiters.

---php
$example = array(
  'language' => "php",
)
---
$example = array(
  'language' => "php",
)
+++python
example = {
  language: "python",
}
+++
example = {
  language: "python",
}

Various front matter format influences

What are the relevant issue numbers?

#52007 (closed)

Does this MR meet the acceptance criteria?

Closes #52007 (closed)

Edited by Travis Miller

Merge request reports