diff --git a/package.json b/package.json index c44866807..2e597947f 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "electron-updater": "^4.2.4", "express": "^4.17.1", "if-env": "^1.0.4", + "remark-breaks": "^1.0.5", "videojs-logo": "^2.0.0" }, "devDependencies": { diff --git a/ui/component/common/markdown-preview.jsx b/ui/component/common/markdown-preview.jsx index 1093e7f65..5a82cfdc8 100644 --- a/ui/component/common/markdown-preview.jsx +++ b/ui/component/common/markdown-preview.jsx @@ -4,6 +4,7 @@ import remark from 'remark'; import remarkAttr from 'remark-attr'; import remarkStrip from 'strip-markdown'; import remarkEmoji from 'remark-emoji'; +import remarkBreaks from 'remark-breaks'; import reactRenderer from 'remark-react'; import ExternalLink from 'component/externalLink'; import defaultSchema from 'hast-util-sanitize/lib/github.json'; @@ -147,6 +148,8 @@ const MarkdownPreview = (props: MarkdownProps) => { .use(inlineLinks) // Emojis .use(remarkEmoji) + // Render new lines without needing spaces. + .use(remarkBreaks) .use(reactRenderer, remarkOptions) .processSync(strippedContent).contents } diff --git a/yarn.lock b/yarn.lock index fd729985d..ddc7723d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9088,6 +9088,11 @@ remark-attr@^0.8.3: html-element-attributes "^2.0.0" md-attr-parser "^1.2.1" +remark-breaks@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/remark-breaks/-/remark-breaks-1.0.5.tgz#e9785f8b174f45c05af542fbeb18354b766e1139" + integrity sha512-lr8+TlJI273NjEqL27eUthPYPTCgXEj4NaLbnazS3bQaQL2FySlsbtgo52gE36fE1gWeQgkn1VdmWsoT+uA7FA== + remark-emoji@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/remark-emoji/-/remark-emoji-2.0.2.tgz#49c134021132c192ee4cceed1988ec9b8ced7eb8"