Curvea

Advanced

Renderer Internals

The renderer creates final HTML.

Main file:

src/renderer/renderPage.js

renderPage(ast)

The renderer receives a resolved page AST-like object containing:

  • HTML content
  • styles
  • scripts
  • external styles
  • external scripts
  • site config
  • features
  • route path
  • SEO object

Legacy document extraction

The renderer can extract <head> and <body> parts from content that already contains a document root.

This supports legacy or full-document page content, but the preferred Curvea model is still:

Page → Layout → Document

Head generation

Head HTML is generated by buildHeadHtml().

It can include:

  • charset
  • viewport
  • theme runtime
  • favicon
  • extracted head HTML
  • SEO tags
  • external CSS
  • inline CSS

Body scripts

Body scripts are generated by buildBodyScriptsHtml() and appended to the app HTML.

Document rendering

The renderer calls renderDocumentShell().

The document shell receives:

  • app
  • head
  • site
  • page

Language and theme attributes

After document rendering, the renderer injects or updates:

  • lang
  • data-theme-mode
  • data-theme

Base path rewriting

The renderer rewrites root-relative href and src attributes according to site.basePath.

Formatting

The final HTML is formatted through formatHtml().

Raw code tokens are restored after formatting.