Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 2
    • Merge requests 2
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !23331

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

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Travis Miller requested to merge travismiller/gitlab-ce:52007-frontmatter-toml-json into master Nov 23, 2018
  • Overview 40
  • Commits 7
  • Pipelines 8
  • Changes 6

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?

#52007 (closed)

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 Dec 03, 2018 by Travis Miller
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 52007-frontmatter-toml-json