Like #588, this PR closes a gap where functionality that was easy to access for API users required unnecessary boilerplate for plugin users (in this case the need to create a theme just to be able to apply a tree processor).
The new setting laikaTreeProcessors (empty by default) adds a new shortcut to define such a processor without wrapping it in a theme first.
Example for adding a document to the virtual tree for PDF documents only:
import cats.effect.IO
import laika.ast._
import laika.theme.TreeProcessorBuilder
def intro: Document = ??? // e.g. generated in-memory
val processor = TreeProcessorBuilder[IO].mapTree { tree =>
tree.modifyTree(_.prependContent(intro))
}
laikaTreeProcessors += LaikaTreeProcessor(processor, OutputContext(PDF))
Like #588, this PR closes a gap where functionality that was easy to access for API users required unnecessary boilerplate for plugin users (in this case the need to create a theme just to be able to apply a tree processor).
The new setting
laikaTreeProcessors
(empty by default) adds a new shortcut to define such a processor without wrapping it in a theme first.Example for adding a document to the virtual tree for PDF documents only:
Needs to be merged after #588.