Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt plugin: add new laikaTreeProcessors setting #598

Merged
merged 4 commits into from
Mar 29, 2024
Merged

Conversation

jenshalm
Copy link
Contributor

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))

Needs to be merged after #588.

@jenshalm jenshalm added this to the 1.1.0 milestone Mar 23, 2024
@jenshalm jenshalm changed the base branch from plugin/render-config to main March 29, 2024 19:16
@jenshalm jenshalm merged commit d0fb80a into main Mar 29, 2024
11 checks passed
@jenshalm jenshalm deleted the plugin/tree-processor branch March 29, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant