Created a plugin for frontmatter#51
Conversation
|
|
src/plugins/pluginTypes.ts
Outdated
| regexMarkdownModifications?: IRegexMarkdownModification[]; | ||
|
|
||
| // operations on pages to define the markdown's frontmatter | ||
| frontmatterTransform?: { |
There was a problem hiding this comment.
I'm not completely sold on the frontmatterTransform name. Can you think of a better one?
There was a problem hiding this comment.
How about frontMatterGenerator? I'm camel casing "Matter" because front matter is normally written as two words.
src/plugins/pluginTypes.ts
Outdated
|
|
||
| // operations on pages to define the markdown's frontmatter | ||
| frontmatterTransform?: { | ||
| build: (page: NotionPage) => string; |
There was a problem hiding this comment.
how about getFrontMatter() to be parallel with getStringFromBlock() and getReplacement().
There was a problem hiding this comment.
Recently I broke the plugin API when someone needed the context: IDocuNotionContext,. Although I don't know why it might be needed, let's just include it here, from the start. Please make it the 1st argument.
There was a problem hiding this comment.
I definitely need the context in a lot of places. Due to the complexity of interconnected documents, providing the full context makes it easier to write custom plugins without the complexity of figuring out where to get the context you need.
|
Great suggestions @hatton! I've applied them all 👍 |
Created a plugin for frontmatter as some of the comments in the codebase suggested. This is helpful for people that might want to create their custom frontmatter. E.g. Adding
created_timeor a different property name to it.Notes for reviewers
I had to make a new field in
IPlugintype to work on the page level. I haven't found a way to avoid that, but feel free to recommend one.This change is