Skip to content
internal/render
On this page

Rendering a page from content held in memory and writing nothing, which is what previewing an unsaved editor buffer needs the build pipeline to do.

#internal/render

#internal/render

Package render renders a page from content held in memory, writing nothing.

The build pipeline turns a post into a page by writing it into the docs tree, building, and deleting it again. That is fine for a build and useless for an editor: previewing an unsaved buffer must not touch the working tree at all -- no injected files, no staleness baselines, no manifest.

This is that path. It hands the same payloads the injector would have written to the build's single-pass entry point as an in-memory overlay, with baseline writing off, and returns the page HTML as the build would have written it. Same directive resolution, same HTML pass, same addressing -- the only difference is that nothing is written.

#PostOptions

Go go
type PostOptions struct

PostOptions is what one [Post] render takes.

#Post

Go go
func Post(opts PostOptions, h *effects.Handle) (string, error)

Post renders one post to its final HTML from an in-memory buffer.

The result is byte-identical to the file a posts-target build writes for the same content saved to disk, and the call writes nothing anywhere.

It is an error when no config is found, when the post is a draft and drafts were not asked for, and when the rendered page is missing from the build result.

Search