docmd Documentation

repository·main·Indexed 24 days ago

https://github.com/docmd-io/docmd

A production-ready, zero-config documentation engine that transforms Markdown files into optimized, AI-native static websites. It features a plugin system via @docmd/api, an isomorphic Markdown parser with support for callouts and tabs, and multiple execution engines including a default JavaScript engine (@docmd/engine-js) and a high-performance Rust-accelerated engine (@docmd/engine-rust) for large-scale sites.

Tokens
58K
Snippets
96
Records
340
Agent score
81%

What's inside docmd

  1. Overview of @docmd/parser

    main

    @docmd/parser is an isomorphic Markdown engine used to parse Markdown into HTML. It is designed to run identically in both Node.js and browser environments. It provides specialized support for documentation-specific Markdown features including:

    • Callouts
    • Tabs
    • Steps
    • Changelogs
  2. Understand the role of @docmd/ui

    main

    @docmd/ui serves as the visual foundation for the docmd documentation engine. It provides the core building blocks used by all official themes, including:

    • EJS layout templates: Structural templates for documentation pages.
    • Core CSS and JavaScript: The base styling and logic for the documentation interface.
    • SVG icon sets: A standardized set of icons used across the ecosystem.

    If you are building a custom theme for docmd, you should build upon these core assets to ensure compatibility with the rest of the engine.

  3. Use @docmd/plugin-search for offline full-text search

    main

    The @docmd/plugin-search plugin provides offline full-text search capabilities for docmd sites. It works by building a search-index.json file at compile time, which allows for fast, fuzzy matching using minisearch.

    Key characteristics:

    • No API keys required: Does not rely on external cloud services.
    • Privacy & Air-gapped friendly: Works entirely locally without external network calls.
    • Zero configuration: It is bundled with @docmd/core and is enabled by default.
  4. AI-native features: MCP and LLM Context

    main

    docmd is designed for AI-driven documentation consumption through several built-in features:

    • MCP Server: Running docmd mcp exposes your documentation to AI agents via stdio, allowing them to search, read, and validate content.
    • LLM Context: At build time, docmd automatically generates llms.txt and llms-full.txt files, providing complete documentation context for LLMs.
    • Agent Skills: Modular instruction sets for LLMs and IDE agents are available via docmd-skills.
    • Browser Tools: One-click buttons in the browser allow users to "Copy as Markdown" or "Copy Context" for easy pasting into AI chats.
  5. Understand Summer template asset priority

    main

    The Summer template uses the docmd template plugin system. Assets are loaded in a specific order based on priority levels. The Summer template's CSS and JS files are loaded at priority 10.

    The full load order is:

    1. docmd-main.css (Priority 0) — Base styles
    2. Theme CSS (e.g., docmd-theme-sky.css) (Priority 5)
    3. summer.css (Priority 10) — The template's styles
    4. Your customCss (Priority 15) — User-provided overrides
    5. Plugin CSS (Priority 20) — Plugin-specific styles
  6. Capabilities of the @docmd/engine-rust

    main

    The Rust engine provides high-performance documentation processing through several specialized capabilities:

    • file-discovery: Uses native filesystem APIs for parallel directory traversal.
    • file-read-batch: Utilizes memory-mapped file reading for efficient large-batch operations.
    • git-log: Provides direct libgit2 integration, meaning the git CLI is not required on the host system.
    • search-index: Employs SIMD-accelerated text processing for faster indexing.
  7. Understand docmd's AI-native features

    main

    docmd is designed for modern documentation workflows involving AI agents and LLMs:

    • MCP Server: Use docmd mcp to expose your documentation via stdio to AI Agents, allowing them to search, read, and verify content directly.
    • AI Context Files: During build, docmd automatically generates llms.txt and llms-full.txt files, providing complete documentation context ready for any LLM.
    • Agent Skills: Access modular instruction sets for LLMs and IDE Agents via docmd-skills.
    • Context Copying: The browser interface includes one-click buttons to copy content as Markdown or as optimized AI chat context.
  8. Understand the docmd _playground workflow and layout

    main

    The playground is intentionally isolated from the monorepo's workspace machinery to ensure it tests the published shape of the packages.

    Workflow

    • Tarball Generation: Tarballs are generated only via pnpm prep.
    • Consumption: pnpm dev and pnpm build consume these existing tarballs. If they are missing, these commands will error.
    • Testing: Automated tests do not install directly in this directory; they copy tars to /tmp/<run>/local-tars/ to run in isolation.

    Directory Layout

    • docmd.config.json: Committed test fixture configuration.
    • docs/: Committed sample markdown files.
    • package.json: Contains dependencies using the file:local-tars/*.tgz format. Versions are synchronized with the tars produced by pnpm prep.
    • local-tars/: (Gitignored) Contains the generated .tgz packages.
    • node_modules/, site/, _docmd-search/: (Gitignored) Generated by pnpm dev or pnpm build.
  9. How @docmd/plugin-threads works

    main
    The @docmd/plugin-threads plugin allows you to embed discussion threads directly within your documentation. Instead of using an external database, comments are stored as ::: threads containers within your Markdown files. This approach means your discussions are version-controlled alongside your content, making them compatible with Git and Pull Request workflows.
  10. How @docmd/deployer architecture works

    main

    The deployer uses an orchestrator pattern to manage file generation.

    1. Orchestrator (index.ts): Resolves user options and handles all I/O (writing files to disk).
    2. Providers: Each target (e.g., Docker, Vercel) is implemented as a provider. A provider is a pure function with the signature (ctx: DeployContext) => string. Providers have no side effects and perform no I/O; they simply return the content of the file to be written.

    This architecture allows for easy extension: adding a new deployment target only requires adding a new provider file without modifying existing ones.

  11. TUI layout and progress components

    main

    The @docmd/tui design system includes several components for structuring terminal output:

    • Banner: Displays the centralized ASCII logo and versioning.
    • Section: Creates box-drawing based sections to group related output.
    • Step: Provides standardized step-by-step progress logging (e.g., showing a task name and its status like DONE).
    • Footer: Renders a consistent footer at the end of the output sequence.
  12. Understand OKF type resolution precedence

    main

    The plugin determines the type for each page using the following order of precedence:

    1. frontmatter.okf.type (nested)
    2. frontmatter.type (top-level)
    3. frontmatter.okfType (legacy)
    4. Path-prefix inference (e.g. /guides/fooguide)
    5. defaultType (with a warning if warnOnMissingType is enabled)

    Supported path-prefix inferences include: guides/, api/, reference/, concepts/, runbooks/, datasets/, metrics/, and tables/.