B Blengi docs

Platform admin

Documentation editor (DB-backed)

The Documentation editor at /admin/docs is a DB-backed CRUD surface for the public /documentation/* site. Pages created here supersede the legacy Blade partials at resources/views/documentation/pages/{slug}.blade.php with the same slug โ€” the public renderer queries the doc_pages table first, then falls back to the Blade partial registered in App\\Support\\DocumentationNav.

What this card ships (Phase 3 #195)

  • The doc_pages schema (slug, title, section, sort_order, body_markdown, is_published, timestamps).
  • Admin CRUD at /admin/docs: grouped index by section, create + edit forms with a markdown editor + live preview, reorder via per-item up/down buttons, draft / publish toggle, and hard delete.
  • Public render path: published DocPages win, unknown slugs fall back to the Blade partial, completely-unknown slugs 404.

What this card does NOT ship (Phase 3 #196 will)

  • Bulk-migrating the ~70 shipped Blade pages into doc_pages rows. They keep working via the fallback path until #196 lands.
  • Cross-section drag-and-drop reorder (today's UI moves a row within its section only).

Creating a page

  1. Open /admin/docs โ†’ click New page.
  2. Fill Title, optionally a Slug (auto-derived when blank), pick a Section from the datalist or type a new one.
  3. Write the body in Markdown. Use the Split view to watch the preview as you type โ€” same GitHub-flavoured renderer the public site uses, with HTML escaping.
  4. Toggle Publish on when ready. Drafts 404 publicly.
  5. Save.

Field reference

ColumnTypeMeaning
slug string(120), unique URL identifier. Renaming is allowed (no Stripe-style external reference), but inbound links won't auto-update โ€” fix them yourself or set up a redirect.
title string(200) Page title (h1) + sidebar entry.
section string(120) Sidebar group. New sections render as new sidebar groups in the public site automatically.
sort_order integer Lower numbers render first within the section.
body_markdown text, max 200000 chars GitHub-flavoured markdown. Raw HTML is escaped for safety.
is_published boolean, default false Drafts 404 publicly. Toggle on once ready.

Overriding a shipped Blade page

To customise a shipped page, create a new DocPage row with the same slug as the Blade partial (e.g. welcome, quickstart, etc.) โ€” the DocumentationController prefers the DB row, so your edit takes effect immediately on publish without touching the Blade file.

Markdown features

  • Standard GitHub-flavoured markdown: headings, lists, links, code blocks, tables.
  • Raw <script>, <style>, and inline HTML are escaped โ€” the renderer is configured with html_input=escape and allow_unsafe_links=false.
  • Wiki-style cross-links: [[other-slug]] are not auto-linked by the GFM renderer; if you want them, write regular markdown links: [Other page](/documentation/other-slug).

Preview rate-limit

The preview endpoint at POST /admin/docs/preview is throttled to 60 requests per minute per user. The editor debounces typing at 400ms, so a normal editing session fits well under the cap; pasting a large document or holding a key can briefly hit the limit. When that happens the preview pane shows a banner explaining how long to wait โ€” the editor resumes previewing automatically once the window resets.

See also: Migrating Blade docs into the database for bulk-importing the shipped documentation pages.