Skip to content

Commit

Permalink
Merge pull request #4462 from nextcloud-libraries/backport/4461/stable7
Browse files Browse the repository at this point in the history
[stable7] fix(`NcRichText`) - keep newlines in rendered Markdown
  • Loading branch information
nickvergessen authored Aug 24, 2023
2 parents 29a8a86 + 7ada1aa commit 9c03fa0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/NcRichText/NcRichText.vue
Original file line number Diff line number Diff line change
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 9c03fa0

Please sign in to comment.