/CLAUDE.md
CLAUDE.md at /CLAUDE.md
Path: CLAUDE.md
zudo-codemirror-wisdom
Takazudo's personal CodeMirror 6 dev notes, built with zudo-doc (zfb stack, MDX, Tailwind CSS v4). Base path: /.
Commands
pnpm dev # Start zfb dev server (port 4321)
pnpm build # Build: pnpm build:cm6 && zfb build
pnpm build:cm6 # Rebuild CodeMirror IIFE bundle
pnpm preview # Preview built site via zfb preview
pnpm check # zfb type checking
pnpm check:html # Validate built HTML
pnpm check:links # Check for broken links
pnpm check:pin-parity # Verify pin parity
pnpm check:wrangler-pin # Verify wrangler pin
pnpm check:template-drift # Check for template drift
pnpm format:md # Format MDX files
pnpm format:md:check # Check MDX formatting without writing
pnpm b4push # Pre-push validation (cm6 bundle + format + typecheck + build)
pnpm setup:doc-skill # Generate codemirror-wisdom skill + symlink all skillsContent Structure
English (default):
src/->content/ docs/ /docs/ . . . Japanese:
src/->content/ docs- ja/ /ja/ docs/ . . . Japanese docs mirror the English directory structure
Bilingual rule: When adding or modifying EN content, update the corresponding JA file in the same PR. Keep code blocks and <HtmlPreview> blocks identical between languages -- only translate surrounding prose. If a Japanese version does not yet exist, create it.
Exception: Pages with generated: true in frontmatter (e.g., claude-resources auto-generated pages) do not require Japanese translations.
Content Categories
Top-level directories under src/. Directories with header nav entries are mapped via categoryMatch in src/:
overview/- Introduction and getting startedcore/- Core CodeMirror 6 conceptsvim-mode/- Vim mode integrationextensions/- CodeMirror extensionsrecipes/- Real-world patterns and examplesclaude/- Claude Code integration docs
Auto-generated directories (no header nav entry, managed by claude-resources integration):
claude-md/- CLAUDE.md file documentation (noPage: true)claude-skills/- Claude Skills documentation (noPage: true)
Writing Docs
All documentation files use .mdx format with YAML frontmatter.
Frontmatter Fields
Schema defined in src/ (collections registered in zfb.config.ts):
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Page title, rendered as the page h1 |
description | string | No | Subtitle displayed below the title |
sidebar_position | number | No | Sort order within category (lower = higher). Always set this for predictable ordering |
sidebar_label | string | No | Custom text for sidebar display (overrides title) |
tags | string[] | No | Cross-category grouping tags |
draft | boolean | No | Exclude from build entirely |
unlisted | boolean | No | Built but noindexed, hidden from sidebar/nav |
hide_sidebar | boolean | No | Hide the left sidebar, center content |
hide_toc | boolean | No | Hide the right-side table of contents |
standalone | boolean | No | Hidden from sidebar nav but still indexed |
slug | string | No | Custom URL slug override |
generated | boolean | No | Build-time generated content (skip translation) |
search_exclude | boolean | No | Exclude from search results |
pagination_next | string/null | No | Override next page link (null to hide) |
pagination_prev | string/null | No | Override prev page link (null to hide) |
doc_history | boolean | No | Show/hide the doc history widget for this page |
category_no_page | boolean | No | Make the index.mdx a non-linked sidebar header (frontmatter form of _category_.json noPage) |
category_sort_order | "asc"/"desc" | No | Override child sort direction for a category index |
Content Rules
No h1 in content: The frontmatter
titleis automatically rendered as the page h1. Start your content with## h2headings. Do not write# h1in the MDX body.Always set
sidebar_position: Without it, pages sort alphabetically which is unpredictable. Use integers starting from 1.Kebab-case file names: Use
my-article.mdx, notmyArticle.mdxormy_article.mdx.
Linking Between Docs
Use relative file paths with the .mdx extension:
[Link text](./sibling-page.mdx)
[Link text](../other-category/page.mdx)
[Link text](../other-category/page.mdx#anchor)The remark plugin resolves these during build. External links use standard URLs.
Admonitions
Available globally without imports. Two syntax forms:
Directive syntax (preferred for longer content):
:::note[Custom Title]
Content here.
:::JSX syntax (for inline use):
<Note>Short note content.</Note>Types: <Note>, <Tip>, <Info>, <Warning>, <Danger>, <Caution>
Additional directives:
:::details[Summary text]- Collapsible section:::code-group- Tabbed code block group
Mermaid Diagrams
Mermaid is enabled. Use fenced code blocks:
```mermaid
graph TB
A --> B
```HtmlPreview Component
For interactive HTML/CSS/JS previews with code display:
<HtmlPreview html="<div>Hello</div>" css="div { color: red; }" />Use js/displayJs props for JavaScript demos.
Live Demos (CM6 Bundle)
Pre-built IIFE bundle at public/ exposes window.CM in every HtmlPreview iframe.
Rebuild:
pnpm build:cm6(entry:scripts/)cm6- bundle- entry. ts jsprop: runtime code usingCM.*globalsdisplayJsprop: clean ESM imports shown in "Show code" panelThe bundle is injected via
settings.htmlPreview.head(base/, path/)assets/ cm6- bundle. min. js Keep HtmlPreview blocks identical in EN/JA -- only translate surrounding text.
Navigation Structure
Navigation is filesystem-driven. Directory structure directly becomes sidebar navigation.
Sidebar Ordering
Pages are ordered by
sidebar_position(ascending). Without it, alphabetical order is used.Category index pages (
index.mdx) control category position via their ownsidebar_position.
Category Index Pages
Create index.mdx in a category directory when you want custom intro copy, description, or explicit sidebar ordering. The framework auto-generates category index pages when missing, but explicit ones give better control.
Category Configuration
Use _category_.json for category-level metadata when needed:
{
"label": "Category Name",
"position": 900,
"description": "Category description",
"noPage": true
}The noPage: true flag means the category has no landing page (just groups items). Alternatively, use category_no_page: true in an index.mdx frontmatter.
Header Navigation
Defined in src/ via headerNav. Each item maps to a top-level content directory via categoryMatch:
{ label: "Overview", path: "/docs/overview", categoryMatch: "overview" }categoryMatch must be a single top-level directory name. Adding a new header nav item requires editing settings.ts.
Content Creation Workflow
Adding a New Article
Create the English
.mdxfile in the appropriate category undersrc/content/ docs/ Add frontmatter with at least
titleandsidebar_positionWrite content starting with
## h2headings (not# h1)Create the matching Japanese file under
src/with the same pathcontent/ docs- ja/ Keep code blocks, Mermaid diagrams, and
<HtmlPreview>blocks identical -- only translate proseRun
pnpm format:mdto format the MDX filesRun
pnpm buildto verify the site builds correctly
Adding a New Category
Create the directory under
src/(kebab-case)content/ docs/ Create
index.mdxwithtitle,description, andsidebar_positionAdd a
headerNaventry insrc/withconfig/ settings. ts categoryMatchpointing to the directory nameMirror the directory structure under
src/content/ docs- ja/ Run
pnpm buildto verify
Doc Skill (codemirror-wisdom)
The codemirror-wisdom skill (.) is generated by pnpm setup:doc-skill (runs scripts/). It is gitignored -- do NOT track it in git or edit it directly. To update the skill content, edit the generator script and re-run pnpm setup:doc-skill.
MDX Components
Available globally in MDX without imports:
<Note>,<Tip>,<Info>,<Warning>,<Danger>,<Caution>- Admonitions<HtmlPreview>- Interactive HTML/CSS/JS preview with code display
Project Layout
pages/ # Host- app routing layer (zfb entry points)
src/
components/ # Shared UI components
config/ # settings. ts — site- wide config, docs- schema. ts — frontmatter schema
content/ # MDX doc pages (docs/ + docs- ja/ )
utils/ # Shared utilities
plugins/ # zfb integration plugins (. mjs)
zfb. config. ts # Build config (framework, collections, plugins, adapter)Site Config
Base path:
/(root — no subpath prefix)Live URL:
https:/ / zudo- codemirror- wisdom. takazudomodular. com/ Settings:
src/config/ settings. ts Build config:
zfb.config.ts
CI/CD
PR checks: typecheck + build + Cloudflare Workers static assets preview
Main deploy: build ->
wrangler deploy-> Cloudflare Workers + IFTTT notificationHosting: Cloudflare Workers static assets (not Pages)
Secrets:
CLOUDFLARE_ACCOUNT_ID,CLOUDFLARE_API_TOKEN,IFTTT_PROD_NOTIFY