Markdown
kai-markdown
Turn a raw markdown string into rendered prose — headings, bold, italic, lists, blockquotes, and syntax-highlighted code fences — in any framework or plain HTML.
- Shadow DOM
- Shiki highlighting
- 4 prose sizes
- GFM support
- Highlight on/off
Preview
Section titled “Preview”Set content in JavaScript with your markdown string:
<kai-markdown id="md"></kai-markdown>
<script type="module"> import '@kitn.ai/ui/elements';
const md = document.getElementById('md'); md.content = '### Hello\nRenders **bold**, _italic_, and `code`.';</script>content— assign it in JavaScript; HTML attributes don’t support multiline strings cleanly.prose-size— scales body text:xs,sm(default),base,lg. Usesmin message bubbles,base/lgfor doc pages.code-theme— defaults togithub-dark-dimmed; any Shiki theme works.code-highlight="false"— skips Shiki entirely, rendering code fences as plain monospace.
Examples
Section titled “Examples”Default
Section titled “Default”Headings, bold, italic, a list, a blockquote, and a syntax-highlighted TypeScript fence.
Rich Content
Section titled “Rich Content”Ordered lists, unordered lists, blockquotes, and a fenced code block together — representative of typical model output.
Compact Text Size
Section titled “Compact Text Size”prose-size="xs" for dense contexts — cards, sidebar panels, or tooltips.
Large Prose
Section titled “Large Prose”prose-size="lg" for standalone reading contexts — documentation pages or help articles.
Highlighting Disabled
Section titled “Highlighting Disabled”code-highlight="false" renders code fences as plain monospace — no Shiki loads, ideal for raw terminal output or log lines.
| Property | Type | Default | Notes |
|---|---|---|---|
| content | string | '' | The markdown source to render. |
| proseSize | "xs" | "sm" | "base" | "lg" | 'sm' | Text/markdown sizing. |
| codeTheme | string | 'github-dark-dimmed' | Shiki theme for fenced code blocks. |
| codeHighlight | boolean | true | Disable syntax highlighting (no Shiki loads). |
Composed from
Section titled “Composed from”This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.