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 to the bottom #67

Closed
klml opened this issue Jun 29, 2020 · 1 comment
Closed

front matter to the bottom #67

klml opened this issue Jun 29, 2020 · 1 comment

Comments

@klml
Copy link

klml commented Jun 29, 2020

Front-matter has some confusing disadvantages for "normal" users who only want to edit the prose. I would like to allow the front matter block at the bottom of a document, after the prose.

This is similar to #22.

@eyeseast
Copy link
Owner

eyeseast commented Mar 1, 2021

Hi. Very belatedly, you could probably do this pretty easily with a custom handler: https://python-frontmatter.readthedocs.io/en/latest/handlers.html

Something like this (haven't tested it):

class ReverseYAMLHandler(YAMLHandler):
    def split(self, text):
        """
        Split text into frontmatter and content
        """
        content, fm, _ = self.FM_BOUNDARY.split(text, 2)
        return fm, content

That assumes a document that looks something like this:

Here is your content.

---
title: My title
---

Try that and see if it works.

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

2 participants