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

    import { MEDIAWIKI_CONFIG } from "react-wikitext/configs";
    import type { ParserConfig } from "react-wikitext/configs";

    /configs contains site config constants and types only; it loads neither the parser nor React. Config is fixed when the parser is created; mutating the original object afterwards has no effect.

    Constants

    ConstantDescription
    MEDIAWIKI_CONFIGDefault config from the wikiparser-node@1.48.1 site snapshot
    type ParserConfig = ConfigData & { excludes?: string[] };

    Fields come from upstream wikiparser-node. The library exports neither a normalization function nor source constants; the minimum config is not part of the public API. Read it from the upstream package yourself if you need it and accept the degraded behavior.

    Creating a parser

    import { createWikiparser } from "react-wikitext/parse";
    import { MEDIAWIKI_CONFIG } from "react-wikitext/configs";
    
    const parser = createWikiparser({
      config: MEDIAWIKI_CONFIG,
      defaults: { pageName: "Example" },
    });
    • The factory deep-copies and normalizes config: it fills excludes, normalizes doubleUnderscore, and performs a minimal shape check.
    • Invalid config throws WikitextParseError("INVALID_CONFIG").
    • Changing config requires a new parser, so parsing never mutates shared config implicitly.
    • defaults are per-parser defaults that each call can override; budget merging is described in Parsing /parse.

    Custom site config

    For site differences, copy MEDIAWIKI_CONFIG and adjust fields; this is the supported path. Do not rely on the upstream minimum config as a public option: it silently degrades <ref>, <gallery>, and file parameters, and the library makes no compatibility promise for it. If you genuinely need minimal recognition, read wikiparser-node/config/minimum.json and convert it to ParserConfig yourself after confirming those degradations are acceptable.

    Relation to budgets

    Site config does not contain parse budgets. Source length, node counts, and depth are parse options merged as "per-call → factory defaults → shared defaults"; see Parsing /parse.