MAIDR JavaScript API
    Preparing search index...
    • Converts a parsed diagram against its rendered SVG.

      Separate from createMaidrFromMermaid so a caller that already holds the parsed diagram -- or a test with a stand-in database -- need not parse again.

      A drawing Mermaid sized to its container is given the width it was drawn at, so MAIDR's figure draws it at Mermaid's size, and every drawing is padded inside that size so MAIDR's focus ring covers none of it.

      The adapter's own words are written in options.language, or else in the language MAIDR speaks to the reader. A figure made here does not follow a change of language; one made by createMaidrFromMermaid, which can parse the diagram again, does.

      Parameters

      • diagram: { type: string; db: unknown; text?: string }

        The parsed diagram: its type and database

        • type: string

          The diagram type Mermaid detected

        • db: unknown

          The diagram's database

        • Optionaltext?: string

          The text it was parsed from

      • svg: SVGSVGElement

        The SVG Mermaid rendered from the same text

      • options: MermaidAdapterOptions = {}

        Figure options

      Returns Maidr

      The MAIDR figure

      Error when the diagram type is not one the adapter reads. A diagram of a type it reads but with nothing in it becomes a figure with no layers, which MAIDR announces as empty