Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/assets/javascripts/notebook
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/assets/javascripts/notebook')
-rw-r--r--app/assets/javascripts/notebook/cells/markdown.vue11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/assets/javascripts/notebook/cells/markdown.vue b/app/assets/javascripts/notebook/cells/markdown.vue
index e4cde0d4ff3..c09db6851e5 100644
--- a/app/assets/javascripts/notebook/cells/markdown.vue
+++ b/app/assets/javascripts/notebook/cells/markdown.vue
@@ -37,6 +37,11 @@ const katexRegexString = `(
.replace(/\s/g, '')
.trim();
+function deHTMLify(t) {
+ // get some specific characters back, that are allowed for KaTex rendering
+ const text = t.replace(/&#39;/g, "'").replace(/&lt;/g, '<').replace(/&gt;/g, '>');
+ return text;
+}
function renderKatex(t) {
let text = t;
let numInline = 0; // number of successfull converted math formulas
@@ -57,9 +62,7 @@ function renderKatex(t) {
while (matches !== null) {
try {
- const renderedKatex = katex.renderToString(
- matches[0].replace(/\$/g, '').replace(/&#39;/g, "'"),
- ); // get the tick ' back again from HTMLified string
+ const renderedKatex = katex.renderToString(deHTMLify(matches[0].replace(/\$/g, '')));
text = `${text.replace(matches[0], ` ${renderedKatex}`)}`;
} catch {
numInline -= 1;
@@ -68,7 +71,7 @@ function renderKatex(t) {
}
} else {
try {
- text = katex.renderToString(matches[2].replace(/&#39;/g, "'"));
+ text = katex.renderToString(deHTMLify(matches[2]));
} catch (error) {
numInline -= 1;
}