npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@catatsumuri/inkstream

v1.1.2

Published

Markdown engine for Mintlify-style JSX tags, Zenn directives, and GFM: AST-based tag pairing instead of line-based string preprocessing.

Readme

inkstream

Markdown engine for Mintlify-style JSX tags, Zenn directives, and GFM, built as remark/rehype plugins over the mdast tree rather than a line-based string preprocessor. An earlier unreleased prototype used a line-based directive pipeline; this package is the published implementation.

Try the live example site in English or Japanese.

Install

Published on npm as @catatsumuri/inkstream:

npm install @catatsumuri/inkstream

Releases are published from v* tags by GitHub Actions (trusted publishing with provenance). dist/ is also committed and CI checks it matches a fresh build, so a GitHub commit pin (github:catatsumuri/inkstream#<sha>) works even when the installing environment sets ignore-scripts=true.

Syntax support

inkstream defines its own Mintlify-style syntax rather than claiming Mintlify/MDX compatibility. What is supported, partial, or unsupported is tabulated in docs/syntax.md.

Example site

The live example site is a small React playground. It shows each sample's Markdown beside the output of this package's InkstreamMarkdown renderer. Its source is in site/. The Markdown sources live in site/examples/; edit one to change the site example. English and Japanese are available from the header switcher; ?lang=en and ?lang=ja are shareable URLs. The Japanese sample sources live in site/examples/ja/.

The switch translates the documentation and sample Markdown. Some controls inside the library's default renderers (such as quiz buttons) are still in English. To run the site locally:

npm ci
npm run docs:dev

npm run docs:dev builds the library first, then starts Vite. Run npm run docs:build to generate static files in site-dist/.

The site is hosted on GitHub Pages. After updating examples or site code on main, run the Example site workflow manually with Run workflow. It builds and deploys site-dist/. Site deployments do not change the npm package version.

Example application: InkRail

InkRail is a Laravel + Inertia + React application for writing and publishing English/Japanese Markdown articles. It renders articles with inkstream and is the reference for using the package inside a real application.

What it demonstrates:

  • Rendering with InkstreamMarkdown from @catatsumuri/inkstream/react, and using slugify from @catatsumuri/inkstream/advanced.
  • Choosing a syntax profile per document (all or zenn).
  • Replacing the default h2/h3 renderers through components, built on headingComponents and extractRenderedHeadingText, to add an "edit this section" button.
  • Mapping --ink-* variables to the application's own theme and overriding ink-html-embed styles in a small stylesheet.
  • Sample articles for the supported syntax in its live-demo branch.

InkRail does not use every feature. At the time of writing it does not enable Generative UI, does not use the basic profile, and its samples do not cover Frame. It may also depend on an earlier inkstream release than the latest; check its package.json. Use it for integration patterns, and use the example site, syntax reference, and Generative UI section for the full feature set.

Generative UI

Enable generativeUi on InkstreamMarkdown to render a restricted declarative UI alongside Markdown. Static Box, Row, Column, and Icon tags reuse the existing Card and Badge components. Button, Slider, Checkbox, Select/Option, Input, and Form provide application-connected controls in the all profile.

Inputs report typed changes through onGenerativeUiEvent; use generativeUiValues to control them from application state. Forms report { type: "submit", id, action, values }, including untouched input defaults. Applications with exhaustive switches on GenerativeUiEvent must handle the submit variant.

Set streaming (default false) to true while receiving generated Markdown, then false when generation completes. Default Generative UI controls remain visible but disabled while generating, and all action/change/submit notifications are suppressed without replay. Controlled values continue updating; toggling the flag does not remount inputs or reset their values. Ordinary links, Tabs, Accordion, and Quiz are unaffected. Custom-renderer interactions and independent side effects remain application responsibilities.

Two optional controls refine streaming behavior:

  • streamingMode="block" enables explicitly completed UI during generation, once descendant tags and ancestor containers are also complete. The default "document" mode waits for the whole response. Automatic tag recovery does not count as block completion.
  • streamingUpdateInterval={50} coalesces generated-text display updates in milliseconds. The default 0 updates immediately. Completion flushes the latest full source immediately; controlled values and events are not delayed.

Unchanged source now skips reparsing on UI-state updates. Changed source still reparses the document; incremental parsing and completed-AST caching are not provided. Block completion does not validate syntax or authorize operations.

Changing a field or Form ID resets its input state to prevent values transferring to another identity. Insertion and reordering may reset uncontrolled values; use unique IDs and application-controlled values when retention is required. Focus preservation when disabling or replacing controls is not guaranteed.

Generated handlers and JavaScript are never executed. The application must allowlist action identifiers, validate values, authorize operations, and perform API requests. Forms prevent native navigation; their controls remain disabled until hydration. Nested Forms are hidden and duplicate field IDs reject submission. Automatic form collection supports default input renderers; custom components replacements are not guaranteed. Do not mount inside an existing HTML form. Use unique input IDs throughout a document.

See the syntax and event reference, Japanese reference, and application integration demo. Generative UI remains opt-in; the default Markdown profile is unchanged.

Agent skills

skills/ holds two Agent Skills for Claude Code and compatible agents: inkstream-cli (using the CLI) and inkstream-syntax (writing inkstream markdown). Copy or symlink a folder into ~/.claude/skills/ (or a project's .claude/skills/) to use it.

Versioning

From 1.0.0, releases follow semantic versioning: major versions cover incompatible changes to documented public APIs and supported syntax, minor versions add compatible features, and patch versions fix bugs. Use ^1.0.0 for compatible updates or ~1.0.0 for patch updates only. See CHANGELOG.md for the compatibility contract and release notes.

API surface

  • @catatsumuri/inkstream — the public API: normalizeInkstreamMarkdown, inkstreamRemarkPlugins, inkstreamRehypePlugins, extractMarkdownHeadings, extractPlainText, remarkWikilinks, and the parsers/URL helpers custom renderer components use (parseChartFence, parseQuizFence, parseTreeFence, parseImageMetadata, parseGithubUrl, ...).
  • @catatsumuri/inkstream/advanced — the building blocks those are made of (individual plugins and normalizers, the tag manifest, slug helpers), for composing a custom pipeline. Prefer the root API unless you need to configure individual stages. Documented exports follow the same versioning policy.
  • @catatsumuri/inkstream/react — the React renderer (/react/mermaid for the Mermaid component, /styles.css for the stylesheet).

Pipeline

Processing runs in three stages: string-level normalizers (in the order normalizeInkstreamMarkdown applies them), then the remark plugin chain (in the order inkstreamRemarkPlugins lists them), then HTML transforms (inkstreamRehypePlugins, after remark-rehype). The stages below describe the default all profile; selected profiles use createInkstreamRemarkPlugins and matching normalization options.

Stage 1 — string normalizers

  1. normalizeHtmlHeadings(markdown) — rewrites supported <h1>–<h6> HTML headings to Markdown headings before the rest of the pipeline runs.
  2. normalizeMintlifyBlocks(markdown) — line-based pre-pass that joins complete multiline block openings into single lines, surrounds standalone tag lines with blank lines (skipping code fences) so remark parses each tag as its own html flow node, strips the authoring indentation inside open tags (up to the open tag's indent + 4, mirroring the prototype) so indented tag bodies don't become indented code blocks, and flattens JSX array attributes (tags={["A", "B"]} → tags="A,B"), which would otherwise make the tag invalid HTML for remark.
  3. normalizeZennDirectiveShorthand(markdown) — rewrites the friendly :::message alert / :::details タイトル forms into the {.class} / [label] syntax remark-directive requires. Like the prototype, it protects code fences and inline code spans, so literal `:::message alert` examples in prose survive; it also reduces Zenn's @[card](url) / @[github](url) embeds to bare URL lines for a linkify-style renderer to pick up. It runs after step 1 so tag bodies are already dedented.
  4. normalizeZennImages(markdown) + parseImageMetadata(url) — Zenn's image sizing/caption syntax (![](url =250x), a *caption* line under the image). The sizing suffix lives inside the markdown image destination, where remark's parser refuses spaces, so this stays a line-based step that encodes the metadata into query parameters; an image renderer reads them back with parseImageMetadata.

Stage 2 — remark plugins

remark-parse first does standard markdown parsing, then inkstreamRemarkPlugins runs:

  1. remark-gfm, remark-math, and remark-directive — GFM syntax, and the colon-fence parser that :::message / :::details need. This is the one piece still relying on a third-party directive parser, since colon-fence syntax isn't something a tag-pairing plugin over html nodes can parse.
  2. remarkRestoreTimeText — restores clock times such as 09:12 that the directive parser would otherwise mistake for inline directives.
  3. remarkZennDirective — reads the containerDirective nodes remark-directive produces (native :::message / :::details; the Mintlify JSX tags never go through colon-fences in v2).
  4. remarkLinkifyToCard — turns bare-URL paragraphs (including those the Zenn embed normalizer produced) into card/embed nodes.
  5. remarkGithubAlerts — normalizes GitHub blockquote alerts (> [!NOTE] etc.) onto the same aside.msg contract as the Mintlify callouts and :::message.
  6. remarkMintlifyTags — pairs open/close html nodes with a stack (once for each parent's flow children, once for each paragraph's phrasing children) and lifts the nodes between a pair into a mintlifyContainer node carrying name, attributes, and data.hName/hProperties for remark-rehype. Block tag names (Note, Card, Steps, ...) pair at flow level or as a whole single-line paragraph; inline tag names (Badge, Tooltip) pair mid-paragraph without disturbing surrounding text.
  7. remarkHtmlAnchors, remarkHtmlLinks, and remarkHtmlImages — convert the supported safe subset of HTML anchors, links, and images to nodes the default renderers understand; arbitrary raw HTML stays disabled.
  8. remarkTreeTags — converts a paired JSX <Tree><Tree.Folder>…</Tree> block (captured by remarkMintlifyTags) into the same JSON-carrying tree node the ```tree fence produces.
  9. remarkCodeFenceComponents — converts ```tree, ```quiz, and ```chart:bar/```chart:radar fenced code blocks into mintlifyContainer nodes carrying the parsed structure as one JSON-string property (tree, quiz, chart) for a renderer component to read. Malformed fences emit a vfile warning and are left as plain code blocks.
  10. remarkCodeMeta — copies the code-fence meta string into hProperties.metastring so the code renderer receives it.

remarkWikilinks is not part of the default chain; InkstreamMarkdown appends it only when a resolveWikilink resolver is supplied.

Using the library: two layers

inkstream is consumed at two distinct levels, and every feature belongs to exactly one of them. The boundary is the .ink-markdown element: inside it is the library's job; outside it — and everything that needs app-specific knowledge — is the consumer's job.

Layer 1 — Drop-in (zero config)

The /react subpath renders inkstream markdown in one line, and the core package stays React-free:

import { InkstreamMarkdown } from '@catatsumuri/inkstream/react';

<InkstreamMarkdown>{markdownSource}</InkstreamMarkdown>;

Syntax profiles

| Profile | What it enables | | --- | --- | | all (default) | GFM, math, Mintlify-style components, Frame, Tabs, and component fences; Generative UI is a separate opt-in | | zenn | GFM, math, Zenn messages/details, inline footnotes, provider embeds, images, and source line breaks; component tags stay source text | | basic | CommonMark without GFM, math, directives, or special component/fence rendering |

<InkstreamMarkdown syntax="zenn">{markdownSource}</InkstreamMarkdown>
<InkstreamMarkdown syntax="basic">{markdownSource}</InkstreamMarkdown>

zenn enables standard Markdown plus Zenn's authoring dialect, including tables, math, footnotes, directives and provider embeds. Mintlify tags such as <Note> and Inkstream-only quiz/chart/tree fences remain source text. basic uses standard Markdown without these extensions. Omitting syntax (or using all) retains the existing pipeline for compatibility. all is not a superset of every Zenn-specific behavior, and generativeUi only enables UI tags in all.

Pass the same { syntax: 'zenn' } option to normalizeInkstreamMarkdown, createInkstreamRemarkPlugins, and extractPlainText when composing pipelines. extractMarkdownHeadings(source, prefix, { syntax: 'zenn' }) accepts it as its third argument. CLI commands support --syntax=zenn and --syntax=basic. External embeds require provider access; Gist uses the public GitHub API. See the profile reference or Japanese reference for supported forms.

HTML diagrams

Use an html-embed code fence for HTML, inline CSS, and SVG diagrams in React:

```html-embed
<style>body { font-family: sans-serif; }</style>
<div><strong>Markdown</strong> → AST → Output</div>
```

This works with all and zenn. The renderer filters the source and uses a sandboxed iframe with scripts, forms, and navigation blocked. Source is limited to 50 KiB of UTF-8 and the viewport height is fixed at 500px. External images can load; external scripts, stylesheets, and fonts cannot. Theme-specific styles can use data-theme="light" or data-theme="dark".

An ordinary html fence, the basic profile, and core/CLI output display code rather than this embedded diagram. See HTML embed limits.

Default component rendering

Everything below works with no props and no app-side code:

  • Headings with slug ids, explicit {#custom-id} ids, and copy-link anchors (h1–h4)
  • Callouts in all three syntaxes (Mintlify <Note> tags, :::message, GitHub > [!NOTE] alerts) normalized onto one aside.msg contract
  • Supported Mintlify-style components: Card/CardGroup, Frame, Steps, Tabs, Accordion, Badge, Tooltip, Update, ResponseField/ParamField, CodeGroup, Tree
  • icon="name" on Card and Accordion renders the Lucide icon of that kebab-case name (loaded lazily through lucide-react/dynamic); unknown names render no icon
  • Columns and CardGroup honour cols from 1 to 4 (default 2) from the 48rem breakpoint up
  • Code blocks: Shiki highlighting, copy button, wrap toggle, filename headers (```php:index.php or title="Example.ts"), line numbers (lines), row highlighting (highlight="1-3,5"), a 12-line expandable preview (expandable), and diff mode (```diff js:app.js)
  • ```mermaid diagrams (lazy-loaded chunk, optional peer dependency)
  • ```tree, ```quiz, ```chart:bar / ```chart:radar fences
  • Zenn image sizing/captions (![](url =250x), *caption* line)
  • YouTube embeds from standalone URLs
  • GitHub file embeds from standalone blob URLs (raw.githubusercontent.com allows CORS, so the browser fetches directly — no server help needed)
  • A default look via an optional stylesheet: import '@catatsumuri/inkstream/styles.css';. Every rule targets a stable ink-* class name inside @layer inkstream, so any unlayered rule a consumer writes overrides it without a specificity fight, and eight semantic colors (border/foreground/muted/primary/accent/card) read from --ink-* custom properties with neutral fallbacks — see the file's header comment for the full list and a theme-bridge example.

The renderers themselves stay style-agnostic (only class names, no inline styles) — styles.css is what turns Layer 1's correct structure into something that looks right without any app code. Skip the import entirely for unstyled markup, or import it and override just the --ink-* bridge (Layer 2) to match an existing design system.

Layer 2 — App integration surface

These features are split "parsing in the library, knowledge in the app": the library ships the syntax support and an injection point, and degrades gracefully when the app doesn't provide one. kb_practice is the reference implementation for each.

| Integration point | What the app supplies | Without it | kb_practice reference | | --- | --- | --- | --- | | Theme bridge | --ink-* custom properties pointing at the app's own design tokens | The package's neutral (zinc-style) default colors | resources/css/inkstream.css maps --ink-border → --border, etc. | | resolveWikilink prop | [[path]] → URL (routing/DB lookup) | [[...]] stays literal text | title→id map; unresolved links route to the create form | | ogpEndpoint prop | Server-side OGP proxy (CORS blocks direct fetch) | URL-only link cards | OgpController (validation + 24h cache) | | extractMarkdownHeadings + headingIdPrefix | Table-of-contents UI outside .ink-markdown | No TOC (anchors still work) | DocumentTableOfContents scrollspy | | components prop | Per-tag renderer overrides | Default ink-* renderers | — | | Dark mode | dark class on the document root + CSS for the --shiki-* variables | Light theme only | Tailwind .dark convention | | Page behaviors | Anything tied to navigation lifecycle (e.g. hash-anchor scroll restore in an SPA, where content mounts after the browser's native jump) | Browser defaults | hash restore on Inertia navigation |

Core-only consumers (no React) can use normalizeInkstreamMarkdown + inkstreamRemarkPlugins from the root entry point in any unified pipeline, adding inkstreamRehypePlugins after remark-rehype for math rendering — the golden corpus renderer does exactly this. react and react-markdown are optional peer dependencies, so this path pulls in no React at all.

The /react entry does need lucide-react (a required peer, >=0.400.0 <1.0.0): headings, code blocks, embeds and quizzes use its icons directly. mermaid, recharts and shiki stay optional peers because they are only loaded on demand (a mermaid/chart fence, code highlighting). In a bundler (Vite, webpack, Next.js) this just works; running the built /react entry directly in plain Node ESM depends on how the installed lucide-react exposes its dynamic subpath (versions without an exports map cannot resolve it).

What the AST approach fixes structurally

  • No nesting limit — v1 encoded depth in colon-fence length (7 levels max, 10 − depth colons); v2 nesting is just tree structure.
  • Single-line tags — <Note>text</Note> in one paragraph works.
  • Self-closing tags — <Card title="..." />.
  • Inline tags — <Badge> / <Tooltip> pair mid-sentence.
  • Error tolerance with diagnostics — unmatched close tags stay literal, unclosed tags auto-close at end of parent, and both emit vfile warnings instead of failing silently. Malformed tree/quiz/chart fences fall back to a plain code block with a warning instead of silently dropping data.
  • No redundant raw-JSON dump — v1's tree/quiz/chart directives leave the source fence's code child in the tree alongside the JSON attribute, so the raw JSON also renders as a visible <pre><code> block. v2's mintlifyContainer has no children for these, so only the intended component renders.

Not yet implemented (planned)

  • Per-component attribute schemas (currently reuses v1's global allowlist for hProperties; the full parsed attribute map is kept on the node).
  • Tags inside blockquotes/lists currently require blank lines around them (the normalizer only handles top-level tag lines); fixing this means splitting multi-line html nodes or normalizing per container.
  • Multi-line JSX open tags (an open tag with attributes spread across several lines; v1 joins them in joinMultilineJsxTags).
  • Attribute naming convention: v1 prefixes hProperties with data-<component>-<attr> (e.g. data-card-href), presumably because its output was raw custom HTML elements read via dataset. v2 intentionally uses raw names (href) since containers render through React components that read props directly — this is a deliberate v2 API change, not a gap to close.

CLI

npx @catatsumuri/inkstream <command> [file]

or, once installed as a project dependency, npx inkstream ... / directly via the inkstream bin.

| Command | Output | Use case | | --- | --- | --- | | inkstream render <file\|-> | HTML | RSS feeds, OGP static pages, email bodies. Same pipeline as the golden corpus renderer, so no heading ids (those come from the React heading renderer, not this pipeline) | | inkstream text <file\|-> | Plain, human-readable text | Full-text search indexing, excerpts, OGP description — the raw markdown source is unusable for these as-is (<Card title=...>, ```quiz syntax noise) | | inkstream headings <file\|-> [--json] [--prefix=<p>] | Indented outline, or a JSON array with --json | Server-side table-of-contents precomputation; same shape as extractMarkdownHeadings |

Every command reads markdown from the given file path, or from stdin when the path is - or omitted.

text resolves the same syntax render does (Mintlify tags, Zenn directives, wikilinks) down to prose: a quiz fence contributes its question/options/explanation, a chart fence its title and labels (not the numeric values), a tree fence its file and folder names, and a wikilink its label (or the path's last segment) — none of these have a sensible plain-text form otherwise, so they're handled explicitly rather than silently dropped or dumping raw JSON. Wikilinks resolve without needing a resolveWikilink callback, the same way heading slugs do.

Known limitations (not planned)

Edge cases identified during review, deliberately left unhandled: no occurrence in this project's real documents justified the added parsing surface, and each is easy to work around in authoring.

  • Setext headings (Title underlined by ===/--- instead of a leading #) aren't picked up by extractMarkdownHeadings — a table of contents silently omits them, even though they render fine as <h1>/<h2>. Write headings with #/## instead.
  • Single-quoted attribute values (<Card title='x'>) aren't parsed by parseJsxAttributes' bare/quoted branches (only "x" and brace-wrapped {'x'} are). Use double quotes.

Golden corpus (golden/)

Snapshot regression suite: renders every golden/corpus/*.md fixture through the full pipeline and compares the prettified HTML against the committed baseline in golden/baseline/*.html.

npm run golden             # check; exits non-zero on any diff
npm run golden -- --update # re-render and accept the current output
  • golden/render-v2.ts — the pipeline under test (normalizeInkstreamMarkdown → inkstreamRemarkPlugins → remark-rehype → hast-util-to-html), the same exports consumers use.
  • golden/diff.ts — prettifies output to one tag per line, line-diffs it against the baseline, and writes the current output to golden/output/*.html (gitignored) for inspection.

Fixtures 01–09 are synthetic; 10–14 are the five real syntax-guide documents from thinkstream's SyntaxSeeder (basic markdown, extended markdown/GFM, Zenn syntax, Mintlify syntax, thinkstream syntax) — a far truer signal, and the corpus that surfaced the fence-state, inline-code, indentation, and array-attribute bugs the current pipeline fixes.

The corpus originally drove a prototype-vs-AST comparison (rendering the same fixtures through the prototype's directive pipeline); once every difference was either fixed or decided as an intentional v2 change, the v1 renderer and its file: dependency were dropped and the v2 output became the baseline.

Math

Math is enabled in the default all profile and in zenn, but not basic: $x^2$ is inline math; separate $$ lines enclose display math. A math code fence also renders as display math. Parsing follows remark-math; escape literal currency symbols as \$. Code spans and other code fences remain literal.

React and inkstream render synchronously produce KaTeX HTML + MathML, including during SSR. Existing @catatsumuri/inkstream/styles.css includes the matching CSS and local fonts; standalone CLI HTML needs that stylesheet in its host page. Invalid formulas remain visible and do not abort rendering. KaTeX runs with trust: false; no custom macro configuration is exposed. extractPlainText / inkstream text retain the TeX source without delimiters.

For custom unified pipelines:

import { inkstreamRemarkPlugins, inkstreamRehypePlugins, normalizeInkstreamMarkdown } from '@catatsumuri/inkstream';

const processor = unified()
  .use(remarkParse)
  .use(inkstreamRemarkPlugins)
  .use(remarkRehype)
  .use(inkstreamRehypePlugins);
const file = new VFile(normalizeInkstreamMarkdown(source));
const htmlTree = processor.runSync(processor.parse(file), file);
// file.messages includes formula rendering diagnostics.