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
- https://gohugo.io/content-management/front-matter/ (Supports YAML, TOML, and non-delimited JSON)
- https://middlemanapp.com/basics/frontmatter/ (Supports YAML & delimited JSON)
- No prior example for arbitrary language specifier found.
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
Closes #52007 (closed)
Edited by Travis Miller