For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/help/api.md.
Lynx
  • English
  • Documenting APIs

    The Lynx documentation relies on a structured system to ensure API references are accurate and consistent.

    Compatibility Data (lynx-compat-data)

    The source of truth for platform compatibility is stored in packages/lynx-compat-data. This is a JSON database similar to MDN's browser-compat-data.

    Adding a New API

    1. Navigate to packages/lynx-compat-data.
    2. Find the appropriate JSON file (e.g., lynx-api/global/console/log.json).
    3. Add your API definition following the schema.

    Displaying API Tables

    To display a compatibility table in your documentation, use the <APITable> component.

    It is recommended to define the api field in the frontmatter.

    ---
    api: lynx-api/global/console/log
    ---

    Then place <APITable /> in your MDX file. It will automatically read the api field.

    <APITable />

    Multiple Tables (Explicit Query)

    When you need to display multiple tables on a single page, you can pass the query prop explicitly.

    For example, in fetch, separate tables are used for Headers, Request, and Response:

    ### Headers
    
    <APITable query="lynx-api/fetch/Headers" />
    
    ### Request
    
    <APITable query="lynx-api/fetch/Request" />

    LCD tables only load in the browser

    You can verify valid queries using the Interactive Explorer below.

    API Summary

    For a high-level view of API groups (like methods, properties, events), use <APISummary>. Similar to <APITable>, it defaults to reading from the api frontmatter field.

    <APISummary />

    Interactive Explorer

    You can use the explorer below to find valid API queries and preview their tables.

    Compatibility Explorer
    Search Lynx features and APIs to view their compatibility across platforms
    Quick access:
    Embed this table in your MDX:
    import { APISummary, APITable } from '@lynx';
    
    <APISummary query="css/properties/gap" />
    <APITable query="css/properties/gap" />

    LCD tables only load in the browser

    Validating Documentation

    We provide a script to ensure your API documentation matches the compatibility data.

    pnpm run check-docs

    This script (scripts/check_api_doc) checks for:

    • Invalid api frontmatter keys.
    • Missing documentation for defined APIs.

    TypeDoc Generation

    API reference pages are automatically generated from TypeScript source code using TypeDoc.

    • Config: scripts/typedoc/
    • Command: pnpm run typedoc

    Do not manually edit files generated by TypeDoc (usually in docs/en/api/...), as they will be overwritten. Edit the source comments instead.

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.