From 7ada1aa141724a4a5b24d1ee9eb5d4de06c4c2a4 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Thu, 24 Aug 2023 14:24:40 +0200 Subject: [PATCH] paste no-break-space between '\n' to not leave a new line empty Signed-off-by: Maksim Sukharev --- src/components/NcRichText/NcRichText.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/NcRichText/NcRichText.vue b/src/components/NcRichText/NcRichText.vue index 5c57fe6241..e51624eabd 100644 --- a/src/components/NcRichText/NcRichText.vue +++ b/src/components/NcRichText/NcRichText.vue @@ -41,7 +41,7 @@ export default { Local IP: http://127.0.0.1/status.php should be clickable -Some examples for markdown syntax: **bold text** *italic text* ~~strikethrough~~`, +Some examples for markdown syntax: **bold text** *italic text* \`inline code\``, autolink: true, useMarkdown: true, args: { @@ -217,7 +217,11 @@ export default { }, prefix: false, }) - .processSync(this.text) + .processSync(this.useMarkdown + ? this.text.slice().replace(/\n{2,}/g, (match) => { + return '\n\u00A0'.repeat(match.length - 1) + '\n' + }) + : this.text) .result return h('div', { class: 'rich-text--wrapper' }, [