API Index — Namespaces, Packages, Reports, Indices
MarkdownRenderer
in package
Renders the docs/*.md guides to HTML for the /docs/guide/{topic}
surface. Shared by route/docs.php (full-page render) and
api/docs/page.php (htmx swap) so the conversion + link-rewrite rules
never drift between the two.
The one non-obvious job here is rewriting in-doc .md links. A guide
that writes [routing](./routing.md) produces href="./routing.md",
which resolves to /docs/guide/routing.md (a 404 — the route is
/docs/guide/routing, no extension). rewriteMarkdownLinks() fixes
that: sibling-guide links collapse to /docs/guide/<slug> and any
other .md (e.g. ../STANDARDS.md, ../README.md) points at the
GitHub blob so it still resolves.
Table of Contents
Constants
- GITHUB_BLOB : mixed = 'https://github.com/sibidharan/zealphp/blob/mas...
- GitHub blob base for
.mdfiles that aren't surfaced guides. - GUIDE_SLUGS : array<int, string> = ['getting-started', 'directory-structure', 'run...
- The 16 guide slugs surfaced at
/docs/guide/{topic}. Must match the whitelist inapi/docs/page.php+route/docs.php+ the sidebar intemplate/pages/docs/_sidebar.php. Adding a guide means touching all four sites.
Methods
- render() : string
- Convert GitHub-flavoured Markdown to HTML, then rewrite in-doc
.mdlinks to resolvable URLs. - summary() : string
- Extract a one-line summary from raw Markdown for use as the page
<meta name="description">+ Open Graph description. Returns the first real paragraph (skipping the H1 title, headings, code fences, blockquotes, tables, and list markers), stripped of Markdown syntax and clamped to ~200 chars. Empty string when no prose paragraph is found (caller falls back to the site default). - rewriteMarkdownLinks() : string
- Rewrite in-doc links so they resolve when served at /docs/guide/.
Constants
GITHUB_BLOB
GitHub blob base for .md files that aren't surfaced guides.
private
mixed
GITHUB_BLOB
= 'https://github.com/sibidharan/zealphp/blob/master/'
GUIDE_SLUGS
The 16 guide slugs surfaced at /docs/guide/{topic}. Must match
the whitelist in api/docs/page.php + route/docs.php + the
sidebar in template/pages/docs/_sidebar.php. Adding a guide
means touching all four sites.
private
array<int, string>
GUIDE_SLUGS
= ['getting-started', 'directory-structure', 'runtime-architecture', 'routing', 'api-layer', 'error-handling', 'templates-and-rendering', 'streaming', 'websocket', 'tasks-and-concurrency', 'middleware-and-authentication', 'deployment', 'fuzzing', 'fastcgi-backends', 'apache-parity', 'competitive-analysis', 'standards-and-roadmap']
Methods
render()
Convert GitHub-flavoured Markdown to HTML, then rewrite in-doc
.md links to resolvable URLs.
public
static render(string $markdown) : string
Parameters
- $markdown : string
Return values
stringsummary()
Extract a one-line summary from raw Markdown for use as the page
<meta name="description"> + Open Graph description. Returns the
first real paragraph (skipping the H1 title, headings, code
fences, blockquotes, tables, and list markers), stripped of
Markdown syntax and clamped to ~200 chars. Empty string when no
prose paragraph is found (caller falls back to the site default).
public
static summary(string $markdown) : string
Parameters
- $markdown : string
Return values
stringrewriteMarkdownLinks()
Rewrite in-doc links so they resolve when served at /docs/guide/.
private
static rewriteMarkdownLinks(string $html) : string
Guides cross-link each other and reference repo source files with
paths that are relative to the docs/ directory on disk — none of
which map to a servable URL as-is.
- sibling guide (
routing.md,./routing.md) →/docs/guide/routing - any other repo file (
../src/App.php,../STANDARDS.md,../tests/Foo.php,../route/bar.php) → GitHub blob URL - already-absolute (
http(s)://,/site/path,#anchor,mailto:,data:) → left untouched
Parameters
- $html : string