Skip to content

Commit

Permalink
Merge pull request #4461 from nextcloud-libraries/fix/noid/keep-newli…
Browse files Browse the repository at this point in the history
…nes-markdown

fix(`NcRichText`) - keep newlines in rendered Markdown
  • Loading branch information
nickvergessen committed Aug 24, 2023
2 parents 32c0348 + 6e8d16e commit 2f1f706
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/NcRichText/NcRichText.vue
Expand Up @@ -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: {
Expand Down Expand Up @@ -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' }, [
Expand Down

0 comments on commit 2f1f706

Please sign in to comment.