Skip to content

feature: load default_frontmatter.md for new page#505

Open
benndorfj wants to merge 3 commits into
redimp:mainfrom
benndorfj:benndorfj-patch-1
Open

feature: load default_frontmatter.md for new page#505
benndorfj wants to merge 3 commits into
redimp:mainfrom
benndorfj:benndorfj-patch-1

Conversation

@benndorfj

Copy link
Copy Markdown

Rendering of markdown files via pandoc often requires certain settings in the front matter.

Create a default_frontmatter.md in the directory that will mount to otterwiki's custom folder. Upon creating a new page the frontmatter will be inserted.

Caution: There is no security check or saniztization in place.

Rendering of markdown files via pandoc often requires certain settings in the front matter.
Create a `default_frontmatter.md` in the directory that will mount to otterwiki's custom folder.
Upon creating a new page the frontmatter will be inserted.

@redimp redimp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @benndorfj, thanks for this PR. Please check the changes that I proposed.

I'm not concerned about security checks or sanitizing the default_frontmatter.md since this is admin deployed and controlled.

Comment thread otterwiki/wiki.py Outdated
@benndorfj

Copy link
Copy Markdown
Author

Thank you @redimp!

Your approach is cleaner, only adding linebreaks as necessary and then adding pagename outside of the try: block.

I hope having a default frontmatter is relevant to other otterwiki users.

How do we preceed - do you want me to edit my version and do another pull request?

@redimp

redimp commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Please update your version and push it to benndorfj:benndorfj-patch-1, this will update this PR automatically.

improved try / except logic, now only adding linebreaks if necessary
improved try / except logic, now only adding linebreaks if necessary
@benndorfj

Copy link
Copy Markdown
Author

sorry for the clutter, still learning, first file went into the wrong directory

@redimp

redimp commented Jul 4, 2026

Copy link
Copy Markdown
Owner

No worries, that's what reviews are for.

One last thing before merging: please clean up the commit history. The three commits are variants of the same change, so they should be squashed into a single commit with a message like feature: load default_frontmatter.md for new pages. Roughly:

git rebase -i HEAD~3   # keep the first commit as "pick", change the others to "squash"
git push --force origin benndorfj-patch-1

If you'd rather not wrestle with interactive rebase, just say so and I'll take it from here: I'll squash the commits myself and merge, with you kept as the author of the change.

@benndorfj

Copy link
Copy Markdown
Author

If you are wiling to do the merge / commit, please do so. I very much appreciate it!
This was my first public PR and got sidetraked with other things in the meantime, I try to brush up my git-skills for the next time.
Again, sorry and keep up the good work!

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

Successfully merging this pull request may close these issues.

2 participants