@fastyoke/lcap-markdowneditor
v0.1.0
Published
Markdown editor peer package for the FastYoke SDK's <SmartField /> resolver. Lazy-loaded when an annotation row's @ui/component = 'markdown'.
Maintainers
Readme
@fastyoke/lcap-markdowneditor
Markdown editor peer package for the FastYoke SDK's
<SmartField /> resolver.
When this package loads
<SmartField /> lazy-imports this package when an annotation
row carries:
{ "field_type": "longtext", "ui_config_json": { "@ui/component": "markdown" } }If the package isn't installed, <SmartField /> falls back to
a plain <TextArea /> with a one-time console.warn. Storage
shape is identical (raw markdown string), so swapping is
non-destructive.
Install
npm install @fastyoke/lcap-markdowneditorPeer-deps @fastyoke/sdk@^0.3.0, react@^18, react-dom@^18.
Public API
import { MarkdownEditor, renderMarkdown } from '@fastyoke/lcap-markdowneditor';Side-by-side textarea + live preview. The renderMarkdown(src)
helper is also exported so consumers can render the same
markdown subset on read-only pages without mounting the full
editor.
Implementation status
v0.1.0 (current) — split-pane (textarea + live HTML
preview). Tiny inline markdown-to-HTML renderer covers the
documentation-relevant subset: headings, bold, italic, code
spans, fenced code blocks, bullet + numbered lists, links
(http/https/mailto only), paragraphs, horizontal rules. HTML
is escaped before substitution so source markdown containing
<script> etc. renders as literal text. No marked
dependency.
v0.2.0 (planned) — swap to marked + DOMPurify for
full CommonMark + GitHub-Flavored Markdown support. Catalog
contract stays identical so <SmartField /> consumers don't
need changes.
License
MIT.
