MAIDR Documentation - v4.4.0
    Preparing search index...

    Function rehypeScopeIds

    • A rehype plugin that scopes a message's ids to that message and re-points everything naming them.

      Must run after rehype-sanitize. Before it, the sanitiser would prefix the ids again and undo the agreement this restores.

      The scope keeps the user-content- convention that carries the anti-clobbering guarantee — chat content cannot define an id that shadows one on the host page — and adds the per-message part that makes it unique. That guarantee now comes from here rather than from the sanitiser's prefix, which is the trade this fix makes knowingly; test/util/footnoteScope.esm-test.ts pins it.

      Parameters

      • options: { messageId: string }

        The message this tree belongs to.

        • messageId: string

          Its id, which becomes the scope.

      Returns (tree: Root) => void

      The transform.