typelevel / Laika

Site and E-book Generator and Customizable Text Markup Transformer for sbt, Scala and Scala.js
https://typelevel.org/Laika/
Apache License 2.0
410 stars 44 forks source link

preview server - render document AST under /ast path postfix #513

Closed jenshalm closed 1 year ago

jenshalm commented 1 year ago

This is the penultimate feature PR for 0.19.

It adds the capability to render the document AST in the preview server when adding the /ast postfix to the page's URL.

This is particularly helpful when a developer intends to implement render overrides or rewrite rules and is not sure which nodes to match on.

The server goes beyond just putting the AST out as a huge blob of text as that would not be very helpful:

The AST shown is equivalent to the AST passed to the actual renderer after the final rewrite phase. In case of writing custom render overrides it is the most accurate representation of the nodes you can match on. When writing rewrite rules for earlier phases the actual nodes to match on might differ (e.g. directives and links might still be unresolved).

This functionality finally makes the old demo app obsolete. The code for the app has already been removed some time ago, but once this feature is released as part of version 0.19.4, the running demo app will be decommissioned and the links to it removed from Laika's manual and README.