Skip to content

Commit

Permalink
add GFM plugin to markdown parser
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Jul 26, 2023
1 parent 449d827 commit 479ed3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/NcRichText/NcRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { remarkPlaceholder, prepareTextNode } from './placeholder.js'
import { unified } from 'unified'
import markdown from 'remark-parse'
import markdownGithub from 'remark-gfm'
import breaks from 'remark-breaks'
import remark2rehype from 'remark-rehype'
import rehype2react from 'rehype-react'
Expand Down Expand Up @@ -172,6 +173,7 @@ export default {
renderMarkdown(h) {
const renderedMarkdown = unified()
.use(markdown)
.use(this.autolink ? markdownGithub : null)
.use(remarkAutolink, {
autolink: this.autolink,
useMarkdown: this.useMarkdown,
Expand Down Expand Up @@ -217,7 +219,9 @@ export default {
},
prefix: false,
})
.processSync(this.text)
.processSync(this.text.slice().replace(/\n{2,}/g, (match) => {
return '\n\u00A0'.repeat(match.length - 1) + '\n'
}))
.result
return h('div', { class: 'rich-text--wrapper' }, [
Expand Down

0 comments on commit 479ed3b

Please sign in to comment.