backmarket-oss/github-mermaid-extension

Diffs on .md files trigger syntax errors

amercier opened this issue · 0 comments

Example

image

How to reproduce

  1. Create a PR with a .md file containing a Mermaid chart.
  2. Add a new commit that edits the chart
  3. Go to the PR, select the last commit only
  4. Click on "Display the rich diff" button

Possible solution

Handle diff situation differently. Here's the HTML:

<pre lang="mermaid" class="rich-diff-level-one" data-processed="true">
  <code>graph TD
    <ins>A[/f2/*] -&gt; B{Is the cart empty?}</ins>
    <ins>B --&gt;|Yes| C(Redirect to `/f2/cart`)</ins>
    <ins>B --&gt;|No| D(Render page)</ins>
    <del>A{Is the cart empty?}</del>
    <del>A --&gt;|Yes| B(Redirect to `/f2/cart`)</del>
    <del>A --&gt;|No| C(Render page)</del>
  </code>
</pre>