Skip to content

Conversation

deining
Copy link
Contributor

@deining deining commented Mar 1, 2023

Right now a mermaid code block is enclosed in <div> tags. With this PR applied we now use <pre> tags instead, as suggested and discussed in #1450.

Note: We are using <pre>tag for mermaid code blocks already here, so this PR makes behaviour consistent in all places.

$('.language-mermaid').parent().replaceWith(function() {
needMermaid = true;
return $('<pre class="mermaid">').text($(this).text());
});

This PR closes #1450.


Preview: https://deploy-preview-1451--docsydocs.netlify.app/docs/adding-content/diagrams-and-formulae/#diagrams-with-mermaid

@deining deining added the e0-minutes Effort < 60 min label Mar 1, 2023
@deining deining requested a review from chalin March 1, 2023 08:33
@chalin chalin changed the title Use <pre> tag for mermaid code blocks (#1450) Use <pre> tag for mermaid code blocks Mar 2, 2023
Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. As noted in #1450, according to my tests the pipe into safeHTML needs to be dropped as well.

I'm ok accepting this change as is, but it should be marked as contributing to #1450, not closing it.

@deining
Copy link
Contributor Author

deining commented Mar 2, 2023

As noted in #1450, according to my tests the pipe into safeHTML needs to be dropped as well.

Oops I missed that. safeHTML is now removed.

@deining deining requested a review from chalin March 2, 2023 13:24
Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this fix!

@chalin
Copy link
Contributor

chalin commented Mar 2, 2023

Some style adjustments will be necessary following this change. I'll file a separate issue or submit a PR.

@chalin chalin merged commit 8f4a63f into google:main Mar 2, 2023
@chalin
Copy link
Contributor

chalin commented Mar 2, 2023

@deining deining deleted the mermaid-pre branch March 2, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e0-minutes Effort < 60 min
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mermaid diagrams fail to render
2 participants