From 685cfe7cbeb355918c61859782729c1f84873020 Mon Sep 17 00:00:00 2001 From: ejo090 Date: Mon, 6 Jun 2022 21:37:43 +0900 Subject: [PATCH] fix: Fix markdown line breaks Closes #257 --- client/package-lock.json | 25 +++++++++++++++++++ client/package.json | 1 + .../components/Markdown/Markdown.jsx | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/client/package-lock.json b/client/package-lock.json index 228f268a..5f4553e1 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -34,6 +34,7 @@ "redux-logger": "^3.0.6", "redux-orm": "^0.16.2", "redux-saga": "^1.1.3", + "remark-breaks": "^3.0.2", "remark-gfm": "^3.0.1", "reselect": "^4.1.5", "sails.io.js": "^1.2.1", @@ -18824,6 +18825,20 @@ "node": ">= 0.10" } }, + "node_modules/remark-breaks": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-3.0.2.tgz", + "integrity": "sha512-x96YDJ9X+Ry0/JNZFKfr1hpcAKvGYWfUTszxY9RbxKEqq6uzPPoLCuHdZsLPZZUdAv3nCROyc7FPrQLWr2rxyw==", + "dependencies": { + "@types/mdast": "^3.0.0", + "unified": "^10.0.0", + "unist-util-visit": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-gfm": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz", @@ -36761,6 +36776,16 @@ "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=" }, + "remark-breaks": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-3.0.2.tgz", + "integrity": "sha512-x96YDJ9X+Ry0/JNZFKfr1hpcAKvGYWfUTszxY9RbxKEqq6uzPPoLCuHdZsLPZZUdAv3nCROyc7FPrQLWr2rxyw==", + "requires": { + "@types/mdast": "^3.0.0", + "unified": "^10.0.0", + "unist-util-visit": "^4.0.0" + } + }, "remark-gfm": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz", diff --git a/client/package.json b/client/package.json index cb2c3e87..26692c1b 100755 --- a/client/package.json +++ b/client/package.json @@ -91,6 +91,7 @@ "redux-logger": "^3.0.6", "redux-orm": "^0.16.2", "redux-saga": "^1.1.3", + "remark-breaks": "^3.0.2", "remark-gfm": "^3.0.1", "reselect": "^4.1.5", "sails.io.js": "^1.2.1", diff --git a/client/src/lib/custom-ui/components/Markdown/Markdown.jsx b/client/src/lib/custom-ui/components/Markdown/Markdown.jsx index 6e4e044a..6f59bbe0 100644 --- a/client/src/lib/custom-ui/components/Markdown/Markdown.jsx +++ b/client/src/lib/custom-ui/components/Markdown/Markdown.jsx @@ -2,6 +2,7 @@ import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; +import remarkBreaks from 'remark-breaks'; import './Markdown.module.scss'; // FIXME: import as styles? @@ -35,7 +36,7 @@ const Markdown = React.memo(({ linkStopPropagation, ...props }) => { /* eslint-enable react/jsx-props-no-spreading */