Markdown widget
Render text fields as Markdown in list view and View mode; editing stays a plain :textarea. Opens a whole new class of content applications (blogs, docs) under full RBAC — the rest of a blog already exists (:timestamp + :default-sort descending, "public" read roles + guest login); only rendering is missing.
- Compiler: add
:markdownto*widgets*, legal only on:type :text+:column t(same shape rule as other display widgets). Mirror it inWIDGET_VOCABULARY(App.tsx). - Frontend:
react-markdown+remark-gfm(tables, strikethrough). No raw HTML — default escaping stays on, nodangerouslySetInnerHTML(anyone with update permission writes the field; XSS would be privilege escalation). - List cells: same treatment as
:codecells (clamped height, overflow hidden) so a long post can't blow up the row; View mode renders full length. - New
:uisubkey:hide-label t(default nil = shown; name settled in the plan and confirmed by the 2026-10-21 collision check): suppress the field label on Add, View, and Edit forms when the value is self-evident (a blog body needs no "Body" heading). List column headers always show the label. General subkey — markdown is the motivation, not the only consumer.
Plan: markdown-widget-plan.org.
- Compiler (
lisp/model.lisp)::markdownin*widgets*;:hide-labelin*ui-keys*;valid-hide-label-value(report-ve, called fromfinalize-uiaftervalid-read-only-value, no default injection);compile-fieldfinisher shape rule beside:searchable— three clauses (:type :textvia(or field-type :text),:column t, explicit:targetrejection — an FK declares:type :textwhile storage is forced to:uuid, so the explicit clause is required). - Wire (
lisp/plist-json.lisp):(register-json-boolean-key :hide-label)so an explicitnilserializesfalse, not[]. - Frontend: new shared
web/src/Markdown.tsx(react-markdown 10 + remark-gfm 4, norehype-raw, no customurlTransform, links opentarget"<sub>blank</sub>" rel="noopener noreferrer", =nodeprop destructured away for v9+ typing);markdowninWIDGET_VOCABULARY;renderCellValuebranch (clamp 4.5em,whiteSpace: 'normal'defeats the<td>nowrap; empty renders nothing, matching:code);renderReadOnlyFieldbranch (full length, empty = em dash); edit/add ride the existingtextareabranch condition;FieldLabelhelper replaces all twelve<label>{fieldMeta.label}</label><br />sites in the form loop (strict==true==; the checkbox inline label and button caption stay literal — the caption is the control text). - Fixture
models/test/markdown-test.lisp(:postswith:bodycarrying:widget :markdown :hide-label t);tests/markdown-tests.lisp(two suites:markdown-compileprobes viawidget-compile— text+column compiles, omitted:typecompiles at the finisher, integer / no-column /:target/ rollup-field signal,:hide-labelt / nil / bad-value — plusmarkdown-wireon the fixture:fe-fieldsverbatim:uiand(plist-to-json '(:hide-label nil))→"hide-label":false). One deviation from the plan: the "omitted:type" positive test declares:type :text, becausesql-typerejects a raw nil:typebefore the finisher's(or field-type :text)ever runs (the plan's:searchableanalogy holds only at the finisher, not the storage-type step; noted in the test docstring). Registered indata-ui.asd;run-markdown-testsintests/helpers.lispadded torun-tests. - Docs (
docs/model-reference.md)::markdownin the:widgetrow + semantics bullet (clamping, XSS boundary, compile rules); new:hide-labelrow; closed-set sentence extended. - Wire verified live (
/api/list→"widget":"markdown","hide-label":true),npm run buildclean (351.73 kB bundle), full suite viascripts/data-ui tests: 2098 checks, 39 groups, all passed.
- Slot
- 2800
- Status
- 60 Done
- Tags
- mvp, frontend, model, compiler
- Contributors
- Donnie
- Plans
- Markdown widget (=:widget :markdown=) — plan