From cefd8f184721c30046afd22479e80ed3af774f61 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 30 Sep 2020 17:54:02 +0200 Subject: [PATCH 1/2] match

when replacing hint --- app/src/modules/docs/routes/markdown.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/modules/docs/routes/markdown.vue b/app/src/modules/docs/routes/markdown.vue index a5a6a7ebac..40b1cc0df3 100644 --- a/app/src/modules/docs/routes/markdown.vue +++ b/app/src/modules/docs/routes/markdown.vue @@ -28,7 +28,7 @@ export default defineComponent({ highlight: (code) => highlight.highlightAuto(code).value, }); - const hintRegex = /:::(.*?) (.*?)\n((\s|.)*?):::/gm; + const hintRegex = /

:::(.*?) (.*?)\n((\s|.)*?):::<\/p>/gm; htmlString = htmlString.replaceAll( hintRegex, From b59931e3b4e175081a2b27326fadf33f56a5d855 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 30 Sep 2020 18:10:58 +0200 Subject: [PATCH 2/2] Insert tip before generating html --- app/src/modules/docs/routes/markdown.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/modules/docs/routes/markdown.vue b/app/src/modules/docs/routes/markdown.vue index 40b1cc0df3..dfbb90c141 100644 --- a/app/src/modules/docs/routes/markdown.vue +++ b/app/src/modules/docs/routes/markdown.vue @@ -23,12 +23,10 @@ export default defineComponent({ html.value = ''; return; } - - let htmlString = marked(slots.default()[0].text!, { - highlight: (code) => highlight.highlightAuto(code).value, - }); - - const hintRegex = /

:::(.*?) (.*?)\n((\s|.)*?):::<\/p>/gm; + + let htmlString = slots.default()[0].text! + + const hintRegex = /:::(.*?) (.*?)\r?\n((\s|.)*?):::/gm; htmlString = htmlString.replaceAll( hintRegex, @@ -37,6 +35,10 @@ export default defineComponent({ } ); + let htmlString = marked(htmlString, { + highlight: (code) => highlight.highlightAuto(code).value, + }); + html.value = htmlString; } },