force new lines to render on markdown preview: fix #2390

This commit is contained in:
btzr-io 2020-05-09 23:36:33 -05:00 committed by Sean Yesmunt
parent d85eabf922
commit 276f42f5e7
3 changed files with 9 additions and 0 deletions

View file

@ -52,6 +52,7 @@
"electron-updater": "^4.2.4", "electron-updater": "^4.2.4",
"express": "^4.17.1", "express": "^4.17.1",
"if-env": "^1.0.4", "if-env": "^1.0.4",
"remark-breaks": "^1.0.5",
"videojs-logo": "^2.0.0" "videojs-logo": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {

View file

@ -4,6 +4,7 @@ import remark from 'remark';
import remarkAttr from 'remark-attr'; import remarkAttr from 'remark-attr';
import remarkStrip from 'strip-markdown'; import remarkStrip from 'strip-markdown';
import remarkEmoji from 'remark-emoji'; import remarkEmoji from 'remark-emoji';
import remarkBreaks from 'remark-breaks';
import reactRenderer from 'remark-react'; import reactRenderer from 'remark-react';
import ExternalLink from 'component/externalLink'; import ExternalLink from 'component/externalLink';
import defaultSchema from 'hast-util-sanitize/lib/github.json'; import defaultSchema from 'hast-util-sanitize/lib/github.json';
@ -147,6 +148,8 @@ const MarkdownPreview = (props: MarkdownProps) => {
.use(inlineLinks) .use(inlineLinks)
// Emojis // Emojis
.use(remarkEmoji) .use(remarkEmoji)
// Render new lines without needing spaces.
.use(remarkBreaks)
.use(reactRenderer, remarkOptions) .use(reactRenderer, remarkOptions)
.processSync(strippedContent).contents .processSync(strippedContent).contents
} }

View file

@ -9088,6 +9088,11 @@ remark-attr@^0.8.3:
html-element-attributes "^2.0.0" html-element-attributes "^2.0.0"
md-attr-parser "^1.2.1" 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: remark-emoji@^2.0.1:
version "2.0.2" version "2.0.2"
resolved "https://registry.yarnpkg.com/remark-emoji/-/remark-emoji-2.0.2.tgz#49c134021132c192ee4cceed1988ec9b8ced7eb8" resolved "https://registry.yarnpkg.com/remark-emoji/-/remark-emoji-2.0.2.tgz#49c134021132c192ee4cceed1988ec9b8ced7eb8"