From ea2c17473f5047fcbcea79e9eb227877f4e5fa6a Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 17 Mar 2025 07:29:57 +0700 Subject: [PATCH] Update Markdown.Editor.js Use triple backticks instead of four spaces for block. --- system/admin/editor/js/Markdown.Editor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/admin/editor/js/Markdown.Editor.js b/system/admin/editor/js/Markdown.Editor.js index bec160b..9150670 100644 --- a/system/admin/editor/js/Markdown.Editor.js +++ b/system/admin/editor/js/Markdown.Editor.js @@ -2049,15 +2049,17 @@ chunk.skipLines(nLinesBack, nLinesForward); if (!chunk.selection) { - chunk.startTag = " "; + chunk.startTag = "```\n"; chunk.selection = this.getString("codeexample"); + chunk.endTag = "\n```"; } else { if (/^[ ]{0,3}\S/m.test(chunk.selection)) { if (/\n/.test(chunk.selection)) - chunk.selection = chunk.selection.replace(/^/gm, " "); + chunk.selection = "```\n" + chunk.selection; else // if it's not multiline, do not select the four added spaces; this is more consistent with the doList behavior - chunk.before += " "; + chunk.startTag = "```\n"; + chunk.endTag = "\n```"; } else { chunk.selection = chunk.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm, "");