Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Support for YAML front-matter #208

Closed
dend opened this issue Oct 7, 2019 · 4 comments
Closed

Support for YAML front-matter #208

dend opened this issue Oct 7, 2019 · 4 comments

Comments

@dend
Copy link

dend commented Oct 7, 2019

Currently, when getting the AST for a Markdown file with YAML front-matter, the content is not identified as such.

image

thematic_break is seen first, but after that the closing --- is not properly identified and is seen as part of the header.

@sylvestre
Copy link

Simple test case

import commonmark
parser = commonmark.Parser()
with open('index.md', 'r') as f:
    read_data = f.read()
ast = parser.parse(read_data)

renderer = commonmark.HtmlRenderer()
html = renderer.render(ast)
print(html)

With index.md

---
layout: default
title: Using GeckoView
nav_order: 3
---

# my doc imported from jekyll

We are working on providing detailed usage documentation for all of GeckoView's most popular features. Here is what we have so far.

Generates

<hr />
<h2>layout: default
title: Using GeckoView
nav_order: 3</h2>
<h1>my doc imported from jekyll</h1>

@15228945545
Copy link

15228945545 commented Feb 1, 2020

Currently, when getting the AST for a Markdown file with YAML front-matter, the content is not identified as such.

image

thematic_break is seen first, but after that the closing --- is not properly identified and is seen as part of the header.#208

@sylvestre
Copy link

Here is what i implemented for Firefox
https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/tools/moztreedocs/__init__.py#127

If a fm header is found, extract the data and inject it in the markdown file

@chrisjsewell
Copy link

Note that front matter is supported by https://myst-parser.readthedocs.io/en/latest/using/syntax.html#front-matter (as used by jupyterbook)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants