MarkBind / markbind

MarkBind is a tool for generating content-heavy websites from source files in Markdown format
https://markbind.org/
MIT License
135 stars 124 forks source link

Rework <frontmatter> syntax rules #2295

Open ang-zeyu opened 1 year ago

ang-zeyu commented 1 year ago

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

1753, #2187, #1251

What is the area that this feature belongs to?

Author Usability

Is your feature request related to a problem? Please describe.

Been thinking of this for a while. I think the above 2 more recent linked issues solidify the use case even further.

Not sure if there was any reason for the choice of <frontmatter> as frontmatter syntax.

This type of syntax is overwhelmingly common in SSGs.

// start of page, nothing should preceed it
---
... frontmatter ...
---

... content ...

Describe the solution you'd like

Propose switching to the above syntax. Feature set wise (thinking about overriding of frontmatter properties) there shouldn't be an issue in preserving things. But it is a breaking change and migration work will again be needed.

Benefits:

Cons:

On frontmatter merging:

Describe alternatives you've considered

No response

Additional context

No response

ang-zeyu commented 1 year ago

I think this has been the case since day 1 of markbind. My guess is just that --- ... --- wasn't all that common back then.

@damithc do you have any thoughts or context on this?

@tlylt, I thought through #1753 abit more with #2187. Would having frontmatter and frontmatter tags of all pages available as nunjucks variables solve #1753? (filter the pages you want based on page frontmatter tags)

tlylt commented 1 year ago

Is this issue related to https://github.com/MarkBind/markbind/issues/1851? https://github.com/MarkBind/markbind/pull/2145 is completed to add --- as an alternative frontmatter.

Not sure if there was any reason for the choice of as frontmatter syntax. I think this has been the case since day 1 of markbind. My guess is just that --- ... --- wasn't all that common back then.

https://github.com/MarkBind/markbind/issues/1851#issuecomment-1081805682

ang-zeyu commented 1 year ago

completely forgot about that.. 🤦‍♂️ this would just be for deprecating the HTML version.

We support merging <frontmatter> currently from <include>s. (honestly not too sure on the use cases for this)

Specifically, we can support something like

---
mergeWith: someOtherFile1.md, someOtherFile2.md, ...
---

<include>-ing frontmatter will however have to go. (and <include omitFrontmatter>)

ang-zeyu commented 1 year ago

this would just be for deprecating the HTML version.

I looked at the MR a bit closer, the syntax would be the same but the implementation should be moved from markdown to a preprocessing step before nunjucks.