Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:3641397194 wq Gpt6 Astra Doc Preview Rendering

From Leeroopedia
Knowledge Sources
Domains Documentation, Release_Management
Last Updated 2026-10-26 14:00 GMT

Overview

Technique for rendering project documentation as styled preview HTML pages while validating that download links match the declared release version and build configuration.

Description

Doc preview rendering transforms a README markdown into styled HTML pages that mimic the GitHub repository page layout, while enforcing a contract: the installer download links in the README must exactly match the release version (`VERSION` file) and the `artifactName` templates in `desktop/package.json` across all platform/architecture/extension combinations. This catches broken or stale download links before a release.

The renderer produces two variants from one README: a local preview (with `/docs/` path rebasing and a link to the interactive workbench) and a published index (with in-page anchors). The source README is never modified. A `--check` mode validates that the generated pages are fresh without writing, enabling CI gating.

Usage

Use this principle when you need to:

  • Preview documentation locally: render the README as a GitHub-style page before publishing.
  • Validate release links: ensure all installer download URLs match VERSION and package.json artifactName templates.
  • Gate releases in CI: use `--check` to fail if preview pages are stale or links are broken.
  • Generate static site pages: produce both local and published HTML from one source.

Theoretical Basis

The renderer is a pure function of three inputs: README body, VERSION, and package.json. The link validator checks a set equality:

expected={url(v,templatep,a,e)∣(p,a,e)∈installers}

actual={href∈README∣href starts with releases/download/}

The contract is actual=expected (multiset equality). Missing or unexpected links raise an error. Path rebasing is a regex substitution that rewrites `src`/`href` attributes pointing to `docs/` with a configurable prefix.

Pseudo-code Logic:

# Abstract algorithm (NOT real implementation)
def generate(root, check=False):
    body = read(root / "README.md")
    version = validate_downloads(root, body)  # set-equality check
    pages = {
        "readme-preview.html": render_page(body, version, local=True),
        "index.html":           render_page(body, version, local=False),
    }
    if check:
        assert_all_fresh(pages)
        return
    for path, html in pages.items():
        write(path, html)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment