-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generalize content processing with markdown as default #4
Comments
Sounds good. Can yon create a PR on this? |
Going good here 😄 Existing tests are green. |
How do I merge my super duper change now... 23f98f7 |
An option (no guarantees):
|
Warum einfach, wenn's auch kompliziert geht... |
Git skillz, for da win, wa 😉 |
I didn't see you mention rebase. Skill loss all the way 😸 |
🍰 |
+1 |
Pluggable content processors are beyond the scope of this project. There are a lot alternative solutions out there that offer that functionality already, i.e metalsmith that are 100% pluggable. kartoffeldruck should work out of the box and do only one thing right: Flexible content generation with a powerful templating language in the back (Nunjucks) and a great way to write posts (Frontmatter + Markdown). |
Smilies can still be a great feature, just because they make up a great addition for writing blog posts. |
…rked as default processor for *.md files (compat behaviour). Implements nikku#4. Processors can be defined in the configuration as follows: ``` { contentProcessors: { '*.md': function(content, page) { return marked(content); }, '*': function(content, page) { return emoji(content); }, } } ``` Object keys are globs matched against the page's id (i.e., including relative path) using minimatch with the options `{ nocase: true, matchBase: true }`. Processor order is preserved, such that multiple matching processors are applied in the order defined. Also adds tests for non-markdown file processing and aggregation based off the example structure. Finally, the method `Kartoffeldruck.isMarkdown` is removed from the +public+ API.
I can see this won't come so I'll close it... |
A content processor is a function(content, page) that processes the content and returns the processed result. Multiple processors can now be defined in the configuration via the contentProcessors property. It may be an object or fn. ``` { contentProcessors: { '*.md': function(content, page) { return marked(content); }, '*': function(content, page) { return emoji(content); }, } } ``` Page ids are matched against the pattern; processor order is preserved, so that multiple processors are used in order. ``` { contentProcessors: function(page) { // return applicable processors, single processor or none return [] || fn; } } ``` Content processing can also be disabled entirely by configuring contentProcessors=false. Content will simply be kept as is, if no processors are defined. Closes #4 BREAKING CHANGE: * the method `Kartoffeldruck.isMarkdown` is not needed anymore and removed from the +public+ API.
Closed via f89d412. |
An option to add a post-processor would be nice. Basically, there could be a stack of content processors (per extension/glob pattern) with markdown being one of them, but that defeats the goal of an 'intentionally non-pluggable' static site generator. This would enable easy additions, which are not easily covered using nunjucks filters, such as emojis (#6).
Update: Made this issue focus on the generalization and extract the smiley request into #6.
The text was updated successfully, but these errors were encountered: