JessicaTegner / pypandoc

Thin wrapper for "pandoc" (MIT)
http://pypi.python.org/pypi/pypandoc/
Other
884 stars 112 forks source link

How to get variables from YAML metadata of a Markdown file #175

Closed ketozhang closed 5 years ago

ketozhang commented 5 years ago

Let's say we have some YAML header in a markdown file like so

---
title: TITLE
---

Some content

Is it possible with pypandoc to extract the "title" variable using pypandoc?

EDIT: There's two ideas I have in mind. One to parse YAML within "---" delimiters. The other begin python-frontmatter.

jankatins commented 5 years ago

This is basically pandoc territory, not pypandoc. It would be better to ask there.

ketozhang commented 5 years ago

Well got it, thanks.

From the ability of pypandoc able to get a string from the converter it seems like it can do more. Otherwise the most simplest wrapper would just be a pythonic way to call pypandoc.

jankatins commented 5 years ago

We currently do not touch the to be converted file in any way, so that would be new for us. Pandoc itself does something with the metadata: https://pandoc.org/MANUAL.html#extension-yaml_metadata_block