nikku / kartoffeldruck

A all-in-one, opinionated, swiss army knife, hackable static site generator.
Other
6 stars 1 forks source link

Generalize content processing with markdown as default (implements #4) #7

Closed jrehwaldt closed 6 years ago

jrehwaldt commented 8 years ago

Allow multiple content processors using marked as default processor for *.md files (compat behaviour). Implements #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.

nikku commented 6 years ago

Merged via f89d412.