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

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