Skip to main content
ClearDocs

Features

15 min readStableBeginner

This page is a live demonstration of every feature available in ClearDocs. Each section below shows a real, working example of a component or capability — the same ones you will use when building your own documentation. Use this page as both a reference guide and a visual catalog of what ClearDocs can do.

Every page in ClearDocs includes a Copy page dropdown button next to the title, allowing readers to export content as Markdown or plain text with a single click.

Code Blocks

ClearDocs renders code blocks with syntax highlighting for 65+ programming languages. Every code block includes line numbers, a language badge, and a copy-to-clipboard button — all enabled by default with no configuration.

JavaScript

JavaScript
JavaScript
async function fetchDocumentation(slug) {
  const response = await fetch(`/api/docs/${slug}`)
  const data = await response.json()
  return data.content
}

TypeScript

TypeScript
TypeScript
interface DocumentPage {
  title: string
  slug: string
  content: string
  lastUpdated: Date
}
 
function formatPage(page: DocumentPage): string {
  return `# ${page.title}\n\n${page.content}`
}

Python

Python
Python
from pathlib import Path
 
def build_navigation(docs_dir: str) -> list[dict]:
    pages = []
    for mdx_file in Path(docs_dir).rglob("*.mdx"):
        pages.append({
            "name": mdx_file.stem.replace("-", " ").title(),
            "path": str(mdx_file.relative_to(docs_dir)),
        })
    return sorted(pages, key=lambda p: p["path"])

Bash

Bash
Bash
npm install
npm run dev
npm run build
npm run format:check

JSON

JSON
JSON
{
  "name": "cleardocs",
  "version": "1.0.0",
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build --turbopack"
  }
}

Line Highlighting

Draw attention to specific lines of code using the {1,3-5} syntax after the language identifier. Highlighted lines receive a distinct background color, making it easy to point readers to the most important parts of a code example.

TypeScript
TypeScript
interface User {
  id: string
  name: string
  email: string
  role: 'admin' | 'user'
}

Line Numbers

Line numbers are enabled by default on all code blocks. Add showLineNumbers explicitly or showLineNumbers=N to start numbering from a specific line — useful when showing a snippet from the middle of a larger file.

TypeScript
TypeScript
import { cache } from 'react'
import { readFile } from 'fs/promises'
 
const getCachedContent = cache(async (slug: string) => {
  const filePath = `./content/${slug}.mdx`
  return readFile(filePath, 'utf-8')
})
 
export default async function DocPage({ params }) {
  const content = await getCachedContent(params.slug)
  return <MDXRemote source={content} />
}

File Title

Show a file path header above any code block with title="filename". This tells readers exactly which file the code belongs to — essential for tutorials and guides where code spans multiple files.

lib/auth.ts
TypeScript
import { SignJWT, jwtVerify } from 'jose'
 
const secret = new TextEncoder().encode(process.env.JWT_SECRET)
 
export async function createSession(payload: Record<string, unknown>) {
  return new SignJWT(payload)
    .setProtectedHeader({ alg: 'HS256' })
    .setExpirationTime('7d')
    .sign(secret)
}

Diff Highlighting

Show code changes inline with // [!code ++] and // [!code --] markers. Added lines appear with a green background and removed lines with a red background. The markers themselves are stripped from the rendered output, keeping the code clean and readable.

TypeScript
TypeScript
function getConfig() {
  return {
    theme: 'light', 
    theme: 'dark', 
    debug: true, 
    debug: false, 
  }
}

Code Groups

The Code Group component organizes multiple code blocks into a tabbed interface. This is ideal for showing the same command across different package managers, or the same logic implemented in different languages. Readers pick their preferred tab and the selection persists.

npm
Bash
npm install next react react-dom

Word Highlighting

Highlight every occurrence of a specific word or pattern using the /pattern/ syntax. This is useful for calling out variable names, function calls, or important identifiers within a code example.

TypeScript
TypeScript
interface DocumentPage {
  title: string
  slug: string
}
 
function renderPage(page: DocumentPage): string {
  return `# ${page.title}`
}

Collapsible Code

Long code blocks can overwhelm a page. The expandable metastring collapses the block to a configurable number of visible lines with an expand button. Readers see the beginning of the code and can expand to view the rest when they need it.

JSON
JSON
{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [{ "name": "next" }],
    "paths": { "@/*": ["./*"] }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}

GitHub-Style Alerts

Alerts are callout blocks that draw reader attention to important information. ClearDocs supports all six GitHub alert types, each with a distinct color and icon to convey the right level of urgency.

ℹ️ NOTE Notes highlight information that users should take into account, even when skimming.

💡 TIP Tips provide optional information to help users be more successful.

📝 IMPORTANT Important information that users need to know to achieve their goal.

⚠️ WARNING Urgent information that needs immediate attention to avoid problems.

CAUTION Advises about risks or negative outcomes of certain actions.

Tabs

The Tabs component organizes content into tabbed panels. Use it to present alternative approaches, framework-specific instructions, or any content where readers need to choose between options. Tab selections can be synced across pages using the syncKey prop, so a reader who picks "React" on one page sees "React" selected on every other page.

React uses a virtual DOM and JSX syntax for building user interfaces with a component-based architecture.

Steps

The Steps component turns an ordered list into a visual step-by-step guide with numbered circles and vertical connectors. This is the standard format for tutorials, onboarding flows, and installation instructions — it makes sequential tasks easy to follow and visually distinct from regular content.

  1. Clone the repository

    Run git clone to get the project files on your local machine.

  2. Install dependencies

    Run npm install to install all required packages.

  3. Configure environment

    Run bash scripts/setup-env.sh or copy .env.example to .env.local.

  4. Start development server

    Run npm run dev to start the development server with hot reload.

Cards

Cards provide a grid-based layout for feature showcases, quick navigation, and content overviews. Each card can include a title, description, optional icon, and optional link. The grid is responsive — it stacks on mobile and expands to your chosen column count on larger screens.

Fast Builds

Turbopack-powered builds with sub-second hot reload for instant feedback during development.

MDX Support

Write documentation in Markdown with the full power of React components embedded directly in your pages.

Full-Text Search

Built-in search across all pages with scored ranking, context snippets, and Cmd+K keyboard shortcut.

Accordion

The Accordion component creates collapsible content sections — ideal for FAQs, troubleshooting guides, and any content where readers benefit from progressive disclosure. Accordions support smooth animation, URL hash deep-linking (so you can link directly to a specific open accordion), and independent open/close state.

MDX is a format that lets you write JSX directly in your Markdown documents. It combines the simplicity of Markdown with the power of React components, allowing you to embed interactive elements, styled layouts, and dynamic content within your documentation pages.

ClearDocs uses JWT-based session cookies for authentication in private mode. Visitors enter a shared password, which is verified against a server-side SHA-256 hash using timing-safe comparison. On success, a JWT session cookie is set with a 14-day expiry. Sessions include browser fingerprinting and are invalidated if the fingerprint changes.

Yes. ClearDocs ships with 26 color themes, each generating coordinated light and dark mode palettes automatically. Set the THEME_VARIANT environment variable to any of the 26 options and restart the dev server — the entire site updates instantly with no code changes.

Badge

Badges are inline status indicators for labeling features, versions, and lifecycle stages. Five color variants communicate different states at a glance.

Default Info New Beta Deprecated

Parameter Fields

The ParamField component provides structured documentation for API parameters. Each field displays the parameter name, data type, location (path, query, body, header), required/optional status, and default value in a consistent, scannable format.

slugstringpathrequired

The unique identifier for the document page. Used in the URL path to resolve the correct content file.

pageintegerqueryDefault: 1

Page number for paginated results. Must be a positive integer. The API returns 20 items per page by default.

statusstringquery

Filter by document status. Allowed values: draft, published, archived. When omitted, all statuses are returned.

Response Fields

The ResponseField component documents the shape of API response bodies. Each field shows the name, data type, and whether the field is always present (required) or conditionally included. Nested objects are documented using dot notation.

idstringrequired

Unique identifier for the document, generated on creation.

titlestringrequired

The document title as provided during creation. Used in navigation and search results.

createdAtstring (ISO 8601)

Timestamp of when the document was created, in ISO 8601 format.

File Tree

The FileTree component renders a visual directory structure from indented text. Use it to show project layouts, folder hierarchies, and file organization without screenshots that go stale.

index.mdx
layout.tsx
globals.css
sitemap.ts
robots.ts
introduction.mdx
features.mdx
api-reference.mdx
health/route.ts
verify/route.ts
logout/route.ts
llms.txt/route.ts
llms-full.txt/route.ts
CodeBlock.tsx
ApiBlock.tsx
CopyPageMarkdown.tsx
ThemeToggle.tsx
Tabs.tsx
GlobalSearch.tsx
auth.ts
theme-variants.ts
language-config.ts
setup-env.sh

Changelog

The Changelog component provides a timeline-based layout for tracking technical changes across releases. Each entry supports seven label types (added, fixed, changed, removed, breaking, deprecated, security) with color-coded badges. This format is designed for developer audiences who need a complete, detailed record of every change.

March 26, 20260.4.0

Added Dark mode toggle with light/dark/system modes and prefers-color-scheme auto-detection.

Added Copy page as Markdown/Plain Text dropdown button next to page titles.

Added 65+ programming languages for syntax highlighting (expanded from 26) with 45 aliases.

Added Auto-generated sitemap.xml, llms.txt, llms-full.txt, OpenGraph meta tags, canonical URLs, and JSON-LD structured data.

Added Health check endpoint at /api/health.

Changed Replaced hardcoded green colors with semantic theme aliases for full 26-palette support.

Changed Reduced session duration from 30 days to 14 days.

Changed Standardized spacing across all components for tighter, commercial-grade layout.

Fixed Focus-visible indicators on interactive elements for WCAG 2.4.7 compliance.

March 25, 20260.2.0

Added Line highlighting, line numbers, file titles, diff highlighting, and code groups for code blocks.

Added Tabs, Steps, Cards, Accordion, Badge, ParamField, and ResponseField components.

Changed ApiBlock now supports multiple response tabs, authentication indicators, deprecation marking, rate limiting info, and auto-generated cURL examples.

March 20, 20260.1.0

Added Initial release with MDX support, syntax highlighting, Mermaid diagrams, GitHub alerts, and global search.

Release Notes

Release Notes are designed for end-user audiences. While the Changelog above provides a complete technical record of every change, Release Notes highlight only the changes that matter to your users — written in benefit-focused language with a card-based layout that communicates the value of each update.

0.4.0March 26, 2026

Commercialization Readiness and AI Features

New Dark mode toggle with light, dark, and system modes that auto-detects your device preference.

New Copy page as Markdown or plain text with a dropdown button next to every page title, for pasting into AI tools like ChatGPT, Claude, or Cursor.

New 65+ programming languages for syntax highlighting, up from 26, covering Swift, Kotlin, Dart, Scala, Elixir, Haskell, Rust, Zig, and many more.

New Auto-generated llms.txt and llms-full.txt endpoints for AI agent discoverability.

Improved 26 theme variants now render correctly across all UI components with semantic color aliases.

Improved SEO with dynamic sitemap, OpenGraph meta tags, canonical URLs, and JSON-LD structured data on every page.

Security Session duration reduced from 30 days to 14 days. Focus-visible indicators added for WCAG accessibility compliance.

0.3.0March 26, 2026

Public Access Mode and Release Notes

New Public/private access mode toggle via ACCESS_MODE environment variable. Set to public for open documentation or private for password-protected access.

New Release Notes component for user-facing announcements with card-based layout and 8 highlight types.

Improved Dynamic robots.txt that automatically allows search engine indexing in public mode and blocks all crawlers in private mode.

0.2.0March 25, 2026

Rich Code Blocks and Documentation Components

New Line highlighting, diff markers, word highlighting, collapsible code, and tabbed code groups for code blocks.

New Tabs, Steps, Cards, Accordion, Badge, and structured API field documentation components.

Fix Code blocks render without hydration flashes on page refresh.

Mermaid Diagrams

Mermaid diagrams are written in standard Markdown code fences and rendered as interactive SVG graphics directly on the page. ClearDocs supports 15+ diagram types — from flowcharts and sequence diagrams to gantt charts and mindmaps. All diagram output is sanitized through DOMPurify for security.

Tables

Standard Markdown tables render with responsive horizontal scrolling on narrow viewports, alternating row backgrounds for readability, and header alignment support.

FeatureStatusDescription
MDX SupportAvailableFull MDX v3 support
Code HighlightingAvailable65+ languages
Mermaid DiagramsAvailable15+ diagram types
Global SearchAvailableFull-text with Cmd+K
Dark ModeAvailableLight/Dark/System
Theme VariantsAvailable26 color palettes
AuthenticationAvailableJWT-based sessions
Auto NavigationAvailableFile-system based
AI ReadinessAvailablellms.txt + copy page
SEOAvailableSitemap + OG + JSON-LD

Comparison Table

The Comparison Table component lets you create side-by-side feature comparisons using 10 visual indicator types. Use it to compare your product against competitors, compare pricing tiers, or compare technology options. The highlight prop visually emphasizes your recommended column.

Documentation Platform Comparison

FeatureClearDocsDocusaurusGitBookMintlify
Self-HostedIncludedIncludedNot availableNot available
Open Source (MIT)IncludedIncludedNot availableNot available
Password-Protected ModeIncludedNot availablePremiumPremium
MDX ComponentsIncludedIncludedNot availableIncluded
Full-Text SearchIncludedPartialIncludedIncluded
Dark ModeIncludedIncludedIncludedIncluded
26 Theme VariantsIncludedNot availableNot availableNot available
Mermaid DiagramsIncludedPartialIncludedIncluded
API Documentation BlocksIncludedNot availableIncludedIncluded
Syntax HighlightingIncludedIncludedIncludedIncluded
Auto Sidebar from FilesystemIncludedIncludedNot availableIncluded
AI Agent Endpoints (llms.txt)IncludedNot availableNot availableNot available
GitHub-Style AlertsIncludedPartialNot availableIncluded
Code GroupsIncludedIncludedNot availableIncluded
Comparison TablesIncludedNot availableNot availableNot available
Zero Config SetupIncludedNot availableIncludedIncluded
No Vendor Lock-InIncludedIncludedNot availableNot available
PricingOne-time, unlimited seatsFree (OSS)Per-seat/monthPer-seat/month

The 10 indicator types available for comparison table cells are:

  • check — included (green checkmark)
  • cross — not available (red X)
  • partial — limited support (amber minus)
  • info — informational note (blue info)
  • star — premium/paid feature (purple star)
  • clock — coming soon (gray clock)
  • plus — available as add-on (teal plus)
  • lock — enterprise/restricted (gray lock)
  • sparkle — new/beta feature (violet sparkles)
  • zap — upgrade tier (amber zap)
  • Any other string renders as plain text.

Use the highlight prop (column index) to visually emphasize a recommended option with a brand-tinted column and "Recommended" label.

Inline Code

Use backticks for inline code like npm run dev or next.config.mjs. Variable names like searchIndex and file paths like app/globals.css are also rendered with inline code styling.

Text Formatting

Standard Markdown formatting is fully supported:

  • Bold text for emphasis
  • Italic text for subtle emphasis
  • Strikethrough for deprecated content
  • Bold and italic combined

Lists

Ordered List

  1. Clone the repository
  2. Install dependencies
  3. Run the setup script
  4. Start the development server

Unordered List

  • Supports nested lists
    • Second level
      • Third level
  • Back to first level

Task List

  • Set up Next.js with MDX
  • Add syntax highlighting (65+ languages)
  • Implement global search with Cmd+K
  • Add Mermaid diagram support (15+ types)
  • Add API documentation blocks with multi-response tabs
  • Line highlighting, diff markers, and word highlighting
  • Code groups and tabbed code blocks
  • Tabs, Steps, Cards, Accordion, Badge
  • ParamField and ResponseField components
  • Table of Contents with scroll-spy
  • Dark mode toggle with system auto-detection
  • 26 theme variants via environment variable
  • Copy page as Markdown/Plain Text button
  • Sitemap, OpenGraph, JSON-LD, canonical URLs
  • llms.txt and llms-full.txt for AI agents
  • Image zoom lightbox
  • Embed component with URL allowlist
  • Changelog and Release Notes components
  • Health check endpoint
  • Add versioning support
  • Add i18n support

API Documentation Blocks

The ApiBlock component renders interactive REST API endpoint documentation with color-coded method badges, request/response JSON with syntax highlighting, authentication indicators, and auto-generated cURL examples. It is the centerpiece component for API reference documentation.

GET/api/v1/statusNo auth required

Check the service health status. Returns the current uptime percentage and software version.

Headers
Acceptapplication/json
Request Example
curl -X GET "/api/v1/status" \ -H "Accept: application/json"
Response200
{ "status": "healthy", "uptime": 99.97, "version": "1.0.0" }
POST/api/v1/tokensBearer Token

Generate an access token with a specified scope and expiration. The token is returned immediately and cannot be retrieved again after this response.

Rate limit: 60 requests / minute
Headers
Content-Typeapplication/json
Request Body
{ "scope": "read:docs", "expiresIn": "30d" }
Request Example
curl -X POST "/api/v1/tokens" \ -H "Content-Type: application/json" \ -d '{"scope":"read:docs","expiresIn":"30d"}'
Response200
{ "token": "eyJhbGciOi...", "expiresAt": "2026-04-23T12:00:00Z" }

Blockquotes

Documentation is a love letter that you write to your future self.

Math Typesetting

ClearDocs renders LaTeX-style math equations inline and as centered blocks through remark-math and rehype-katex. KaTeX produces accessible HTML at build time — no client-side parsing, no runtime layout shift.

Inline math: the mass-energy equivalence formula is E=mc2E = mc^2, and the Pythagorean theorem reads a2+b2=c2a^2 + b^2 = c^2.

Block math:

n!k!(nk)!=(nk)\frac{n!}{k!(n-k)!} = \binom{n}{k} i=1ni=n(n+1)2\sum_{i=1}^{n} i = \frac{n(n+1)}{2}

Use a single $ pair for inline equations and $$ on their own lines for block equations.

MDX Snippets

The <Snippet> component embeds reusable content fragments from the top-level snippets/ directory. Author shared blocks once — auth headers, install steps, legal notices — and reference them anywhere.

The block below is rendered live from snippets/install-note.mdx:

ℹ️ NOTE This is a reusable snippet from snippets/install-note.mdx. Edit the file once and every page that embeds it picks up the change.

Bash
Bash
npm install @your-org/sdk

Snippets share the full MDX component palette and inherit the same variable substitution context as regular pages.

Variable Substitution

Build-time {{vars.x}} placeholders resolve from cleardocs.config.json or NEXT_PUBLIC_DOCS_VAR_* environment variables. Authors write the token once and ClearDocs substitutes the configured value at render time.

This site is configured with apiUrl, supportEmail, version, and brand. Author tokens like the example below and ClearDocs substitutes the configured value at render time:

MDX
MDX
Welcome to {{vars.brand}} version {{vars.version}}. The API base URL is
`{{vars.apiUrl}}`. For support, email {{vars.supportEmail}}.

The rendered output reads: "Welcome to ClearDocs version 1.0.0. The API base URL is https://api.example.com. For support, email support@example.com."

To define your own variables, edit cleardocs.config.json at the project root. Prefix any environment variable with NEXT_PUBLIC_DOCS_VAR_ to inject deployment-specific values (env vars override the config file).

Page Meta Bar

Every MDX page can declare optional YAML frontmatter that drives a compact meta bar below the title — reading time (auto-calculated), lifecycle status (draft, beta, stable, deprecated, archived), and difficulty level (beginner, intermediate, advanced). This page itself sets:

YAML
YAML
---
status: stable
level: beginner
related:
  - /getting-started/introduction
  - /getting-started/api-reference
---

Scroll back to the top of this page to see the meta bar in action. To hide the bar on a specific page, set hideMeta: true in frontmatter.

Below every page ClearDocs renders a footer showing the last-updated timestamp from git log, the most recent contributors, and an "Edit on GitHub" link when NEXT_PUBLIC_REPO_URL is set. The footer is data-driven — no manual maintenance required as the documentation evolves.

Frontmatter related: ['/path/a', '/path/b'] renders a card grid of curated next steps below the article body. Entries are resolved against the navigation tree, so broken links never reach the rendered output. Look for the "Related pages" grid at the bottom of this page; it is populated by the frontmatter shown in the Page Meta Bar section above.

Heading Anchor Copy Buttons

Hover any heading on this page (or focus it via keyboard) to reveal a small copy icon. Clicking it copies a deep-link URL like https://example.com/getting-started/features#math-typesetting to your clipboard and updates the address bar fragment without a navigation. This turns every heading into a shareable bookmark.

The dropdown next to the Copy page button at the top of every page includes one-click deeplinks for ChatGPT, Claude, Perplexity, and Cursor. Each deeplink opens the AI tool with a pre-filled prompt referencing the current page URL — readers go from "I am stuck" to "ask an LLM" in one click.

Smart 404 with Suggestions

When a reader lands on a missing path, ClearDocs runs the requested slug against the static search index using Fuse.js fuzzy matching and surfaces the top five most likely intended pages. Try visiting a non-existent path like /this-page-does-not-exist to see the suggestion list in action.

Dynamic Open Graph Images

Every page exposes a 1200×630 PNG generated on demand by the /og route handler using Next.js's built-in next/og. Social platforms (X, Slack, LinkedIn, Discord) automatically pick up the image from the page's OpenGraph metadata. To preview the image directly, visit /og?title=Hello&breadcrumb=Demo.

Announcement Bar

A site-wide dismissible announcement bar can be activated by setting NEXT_PUBLIC_ANNOUNCEMENT_ID, NEXT_PUBLIC_ANNOUNCEMENT_MESSAGE, and optionally NEXT_PUBLIC_ANNOUNCEMENT_HREF plus NEXT_PUBLIC_ANNOUNCEMENT_LINK_LABEL in your environment. Dismissals persist per announcement ID via localStorage, so changing the ID re-shows the bar to every reader.

MCP Server

ClearDocs ships a built-in Model Context Protocol server at /api/mcp that exposes search_docs and fetch_page tools to AI clients (Claude Desktop, Cursor, Windsurf). The endpoint speaks JSON-RPC 2.0 over stateless HTTP and is gated by MCP_BEARER_TOKEN in private mode. See the MCP server reference for client configuration.

— Damian Conway

Last updated Contributors: Md. Sazzad Hossain Sharkar