github / markup

Determines which markup library to use to render a content file (e.g. README) on GitHub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mermaid diagrams with links do not render as anchors

james-async opened this issue · comments

At some point last week our Mermaid diagrams stopped rendering correctly.

Our Mermaid diagrams use single tick marks around the href tag value in the anchors upon the link text. My expectation is that our diagrams that use single or double tick marks around href attributes continue to render links upon the text between diagram elements.

The mermaid live editor example shows that this is valid syntax.

Examples

basic working, rendering diagram

Simple example renders fine with no anchors on the Text link text -- just as is expected.

flowchart LR
    A[Hard] -->|Text| B(Round)
    B --> C{Decision}
    C -->|One| D[Result 1]
    C -->|Two| E[Result 2]

Single tick marks

This example of the error scenario uses single tick marks around the href, the anchor text. Which is not what is expected. When this renders in a Wiki page or in this issue, the full href text is shown on the diagram
Screenshot 2024-02-13 at 1 06 38 PM

flowchart LR
    A[Hard] -->|<a href='https://github.com/github/markup/issues/github.com" target="_blank" rel="nofollow'>Text<a>| B(Round)
    B --> C{Decision}
    C -->|One| D[Result 1]
    C -->|Two| E[Result 2]

double tick marks

This example of the error scenario does not even render the diagram.

flowchart LR
    A[Hard] -->|<a href="github.com">Text<a>| B(Round)
    B --> C{Decision}
    C -->|One| D[Result 1]
    C -->|Two| E[Result 2]

This example fails with an error Unable to render rich display Diagram error not found.. I've setup this issue such that if the problem is fixed, then just above, would render, but below is a screen shot of the error I am seeing.
Screenshot 2024-02-13 at 12 59 51 PM

appears to be fixed 🤷