From f5af6a37ad01afb6389e8459400d68fd42847c65 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 29 Apr 2025 19:03:50 +0300 Subject: [PATCH] Fix typo --- sdkjs-plugins/content/ai/scripts/engine/library.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdkjs-plugins/content/ai/scripts/engine/library.js b/sdkjs-plugins/content/ai/scripts/engine/library.js index 29f90d2a..8b928d74 100644 --- a/sdkjs-plugins/content/ai/scripts/engine/library.js +++ b/sdkjs-plugins/content/ai/scripts/engine/library.js @@ -227,10 +227,10 @@ } }; - Library.prototype.trimResult = function(data, posStart, isSpaces) { + Library.prototype.trimResult = function(data, posStart, isSpaces, extraCharacters) { let pos = posStart || 0; if (-1 != pos) { - let trimC = ["\"", "'", "\n", "\r"]; + let trimC = ["\"", "'", "\n", "\r", "`"]; if (true === isSpaces) trimC.push(" "); while (pos < data.length && trimC.includes(data[pos])) @@ -259,9 +259,10 @@ }; Library.prototype.getMarkdownResult = function(data) { - let result = data.replace(/```md/g, ""); - result = result.replace(/```/g, ""); - return this.trimResult(result); + let markdownEscape = data.indexOf("```md"); + if (-1 !== markdownEscape && markdownEscape < 5) + data = data.substring(markdownEscape + 5); + return this.trimResult(data); }; exports.Asc = exports.Asc || {};