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

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

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

jenshalm
Copy link
Contributor

@jenshalm jenshalm commented Sep 3, 2023

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 is rendered separately for each section, with original headers rendered between them.
  • It receives proper syntax highlighting.
  • It's rendered in the same page template, with all page navigation and site navigation intact.
  • The site navigation also links to the AST, not the HTML of other pages.
  • To get out of AST mode, the /ast postfix simply has to be removed from the URL again.

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.

@jenshalm jenshalm added this to the 0.19.4 milestone Sep 3, 2023
@jenshalm jenshalm merged commit bece16d into 0.19.x Sep 5, 2023
1 check passed
@jenshalm jenshalm deleted the preview/ast branch September 5, 2023 12:11
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