/** * One attribute's statically-checkable facets. `type` is limited to the three * JSON primitives recheck can compare a parsed literal against; anything richer * upstream (objects, arrays, union types, custom attribute classes) has no * faithful representative here and gets `dynamic: true` instead. */ export interface MarkdocAttributeSchema { type: 'string' | 'number' | 'boolean'; required?: boolean; default?: string | number | boolean; /** Markdoc's `matches` array, renamed for recheck's own vocabulary. */ enum?: readonly string[]; /** * Set when the upstream attribute's type isn't one of the three JSON * primitives, or when the tag's schema carries a `validate()` function. * Recheck's value-shape checks (type and enum) skip such an attribute rather * than guess at business logic they cannot run. `required` is deliberately not * skipped: upstream enforces it purely by presence, independently of `type`, * `matches`, and `validate()`, even for a custom-class-typed attribute, so * `markdoc-attributes` checks it unconditionally. The attribute's name is known * either way, so unknown-attribute checks are unaffected. */ dynamic?: boolean; } export interface MarkdocTagSchema { selfClosing?: boolean; attributes?: Record; } export interface MarkdocSchema { tags: Record; } /** * The object form of the `markdoc` config key. `schema` is required here: the * boolean shorthand `true` unambiguously means `{ schema: 'realm' }`, but an * object with `schema` omitted has no default this format defines, so * `config/schema.ts` rejects it rather than guessing. */ export interface MarkdocUserConfig { schema: 'realm' | false; extend?: { tags?: Record; tagsFile?: string; }; } /** * The already-loaded view of `extend` that `config/validate.ts` builds after * reading and shape-checking `tagsFile` (if any): `fileTags` is that file's * tags, `tags` is the config's own inline `extend.tags`. Kept as two separate * fields, not pre-merged, so `mergeExtend` alone owns the precedence order. */ export interface ResolvedExtend { fileTags?: Record; tags?: Record; } /** * Normalizes the raw `markdoc` config value (boolean shorthand or object form) * into `{ enabled, schema }`. It is called from `config/validate.ts` after AJV * structural validation, but the check order there means it still sees the raw * value when validation failed, so it must never throw on a malformed shape * (`{ schema: 'bogus' }`, a bare string): anything unrecognized normalizes to * disabled. * * `schema: false` deliberately is not "fully off". Parsing and pairing still * run, and only the schema-dependent rules (unknown tag, and the * unknown/required/enum attribute checks) go inert for lack of anything to check * against. `extend` alongside `schema: false` is accepted structurally but has * no effect, since there is no base to merge over. * * `resolvedExtend`, when passed, is the caller's already-loaded view of * `extend` (`tagsFile` read and shape-checked, see config/validate.ts) and * takes over from `raw.extend` entirely -- this module never reads a * `tagsFile` itself, so a caller that resolved one has strictly more * information than `raw.extend` alone. */ export declare function resolveMarkdocConfig(raw: boolean | MarkdocUserConfig | undefined, resolvedExtend?: ResolvedExtend): { enabled: boolean; schema: MarkdocSchema | null; }; /** * Tag names a schema declares self-closing, in the plain `Set` shape * `pairing.ts` consumes so the pairing pass depends on none of this module's * types. */ export declare function selfClosingTagNames(schema: MarkdocSchema): ReadonlySet; //# sourceMappingURL=schema.d.ts.map