Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front matter on markdown files #367

Open
robsonsobral opened this issue Aug 20, 2021 · 3 comments
Open

Front matter on markdown files #367

robsonsobral opened this issue Aug 20, 2021 · 3 comments

Comments

@robsonsobral
Copy link
Contributor

Hi! Is it possible to parse the YAML front matter on markdown files to get title property? Or, at least, to ignore them completelly?

Thank you.

@mirisuzanne
Copy link
Member

I like this idea. From there we could consider what other metadata might be useful. Seems like it should be straight-forward with something like gray-matter, but I'm not sure how MD files are loaded. @jgerigmeyer?

@jgerigmeyer
Copy link
Member

Seems like it should be straight-forward with something like gray-matter, but I'm not sure how MD files are loaded. @jgerigmeyer?

@mirisuzanne Sure, I think that makes sense. We're currently using markdown-it for markdown parsing. We could try markdown-it-front-matter, but it actually looks to me like running through gray-matter before markdown-it would be simpler.

I think the first question is how we want to expose this option to users.

@robsonsobral
Copy link
Contributor Author

I've several files using front matter here. I guess, the only metadata useful would be:

  • title
  • slug
  • lang
  • description

As an example, this is the front matter of a file I'm using on a project (I parse using pandoc).

---
title: "Content modelling"
subtitle: "Lorem ipsum"
author:
- foobar
description: |
    Lorem ipsum
toc: true
toc-title: FOO
titlepage: true
toc-own-page: true
footnotes-pretty: true
date: "2021-06-07"
lang: pt-BR
### gerar PDF: pandoc --template eisvogel -f markdown --pdf-engine=xelatex --mathjax --filter mermaid-filter.cmd content-modelling.md -o content-modelling.pdf
## gerar DOCX: pandoc --template rmd-minion-reference -f markdown --pdf-engine=xelatex --mathjax --filter mermaid-filter.cmd content-modelling.md -o content-modelling.docx
---

If I submit the same file to Herman, just 3 data would be parsed.

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

No branches or pull requests

3 participants