Common examples
Edit this page on GitHub →Every @basemark/common directive, in one page. Rendered server-side via renderMarkdownToHtml() into static HTML, then upgraded client-side into real custom elements — the same two-step path every narrative page on this site uses. This exact markdown also renders unchanged through examples/vanilla's renderMarkdown() and examples/react's MarkdownRenderer.
Alert
Informational callout with a title and body.
Use for errors or anything requiring immediate attention.
Badge
Button
Separator
Content above.
Content below.
Table
Plain GFM tables render with no directive needed:
| Column A | Column B | Status |
|---|---|---|
| Row one | Value | stable |
| Row two | Value | experimental |
Accordion
Body of the first item.
Body of the second item.
Carousel
Any direct child block works as a slide — card here, but a bare image works the same way (next section).
First slide's content.
Second slide's content.
Third slide's content.
Bare images as slides:
Popover
Popover body content, positioned relative to the trigger.
Video
URL-only — provider and embed ID are detected automatically:
Audio
Also URL-only, and provider-agnostic:
Card
Card body content.
Columns
Left column content.
Right column content.
Tabs
Content of the first tab.
Content of the second tab.
Code blocks
Fenced code blocks get syntax highlighting via rehype-highlight, wired into @basemark/core's parse pipeline:
import { createRegistry } from '@basemark/core';
import { registerCommonComponents } from '@basemark/common';
const registry = createRegistry();
registerCommonComponents(registry);
Appendix: failing visibly
Basemark fails loudly, not silently, when a directive is wrong. An unknown directive:
A container missing its closing fence — everything below gets captured inside it instead of rendering separately, and the error banner shows exactly what was swallowed:
This text is inside the broken card.
This heading got swallowed too
So did this paragraph.