Skip to content

Instantly share code, notes, and snippets.

@mardix
Created March 21, 2017 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardix/ee85e2600960bb79d550f77413de280b to your computer and use it in GitHub Desktop.
Save mardix/ee85e2600960bb79d550f77413de280b to your computer and use it in GitHub Desktop.
import frontmatter
from frontmatter import Post as FMPost
def frontmatter_to_file(file, data={}, content=""):
p = FMPost(content=content, **data)
with open(file, "w") as f:
f.write(frontmatter.dumps(p))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment