MAIDR Documentation - v3.75.0
    Preparing search index...

    Function createChatSanitizeSchema

    • The schema TypingEffect hands to rehype-sanitize.

      Built fresh on each call so a caller cannot mutate the shared allowlists. TypingEffect calls it once and hoists the result to module scope — the chat animation re-renders every 10 ms, and the allowlist is the same for every message — so the freshness matters to this function's own contract rather than to anything visible at that call site.

      Deliberately declares only tagNames and attributes. hast-util-sanitize resolves its configuration as {...defaultSchema, ...options} — a shallow merge, one level deep — so every key left out here keeps its default. That is what still strips javascript: from a link or an image without protocols appearing anywhere below: the default map covers href, src, cite and longDesc. Adding a partial protocols key would replace that map outright rather than extend it, which is why the test asserts this schema declares no key beyond the two it means to override.

      Returns Schema

      The allowlist of tags and attributes an AI chat response may render.