Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab FOSS
GitLab FOSS
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge Requests
  • !23331

Merged
Created Nov 23, 2018 by Travis Miller@travismillerContributor0 of 8 tasks completed0/8 tasks

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

  • 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
11.6
Milestone
11.6 (Past due)
Assign milestone
Time tracking
Reference: gitlab-org/gitlab-foss!23331
Source branch: 52007-frontmatter-toml-json