From d7160eba2acc379c63f59c1a20cdaccca4c6db2d Mon Sep 17 00:00:00 2001 From: Amarantha Kulkarni Date: Wed, 7 Feb 2024 10:44:41 -0800 Subject: [PATCH] Fix idify function in interactive-tutorials.js to produce same results as the markdoc tag --- static/js/interactive-tutorial.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/interactive-tutorial.js b/static/js/interactive-tutorial.js index 2cb7a546b1..e46288a856 100644 --- a/static/js/interactive-tutorial.js +++ b/static/js/interactive-tutorial.js @@ -61,8 +61,9 @@ function tl(key) { * and with most non-alphanumeric characters removed. */ function idify(s) { - s = s.replace(/[^\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]/gu, '').trim().toLowerCase() - s = s.replace(/[\s-]+/gu, '-') + // s = s.replace(/[^\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]/gu, '').trim().toLowerCase() + s = s.replace(/([^\w]|[\s-]/gu, '').trim().toLowerCase() + s = s.replace(/[\s-]+/gu, '-') if (!s) { s = "_"; }