We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 020b10b commit 5394582Copy full SHA for 5394582
src/resources/formats/html/mermaid/mermaid-init.js
@@ -1,3 +1,23 @@
1
+/**
2
+ * String.prototype.replaceAll() polyfill
3
+ * https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/
4
+ * @author Chris Ferdinandi
5
+ * @license MIT
6
+ */
7
+if (!String.prototype.replaceAll) {
8
+ String.prototype.replaceAll = function (str, newStr) {
9
+ // If a regex pattern
10
+ if (
11
+ Object.prototype.toString.call(str).toLowerCase() === "[object regexp]"
12
+ ) {
13
+ return this.replace(str, newStr);
14
+ }
15
+
16
+ // If a string
17
+ return this.replace(new RegExp(str, "g"), newStr);
18
+ };
19
+}
20
21
mermaid.initialize({ startOnLoad: false });
22
23
const _quartoMermaid = {
0 commit comments