Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui/markdown: preserve line breaks in markdown #3344

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"redux": "4.2.1",
"redux-devtools-extension": "2.13.9",
"redux-thunk": "2.4.2",
"remark-breaks": "4.0.0",
"remark-gfm": "3.0.1",
"stylelint": "15.10.3",
"stylelint-config-standard": "34.0.0",
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/util/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import ReactMarkdown from 'react-markdown'
import { safeURL } from './safeURL'
import remarkGfm from 'remark-gfm'
import remarkBreaks from 'remark-breaks'
import makeStyles from '@mui/styles/makeStyles'
import AppLink from './AppLink'

Expand Down Expand Up @@ -72,7 +73,7 @@ export default function Markdown(props) {
</AppLink>
),
}}
remarkPlugins={[remarkGfm]}
remarkPlugins={[remarkGfm, remarkBreaks]}
allowElement={(element) => {
if (
element.tagName === 'a' &&
Expand Down
123 changes: 123 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,15 @@ __metadata:
languageName: node
linkType: hard

"@types/mdast@npm:^4.0.0":
version: 4.0.1
resolution: "@types/mdast@npm:4.0.1"
dependencies:
"@types/unist": "*"
checksum: 3d8fe54a6fb747376c4cc2f05c319730a5737b77844d8ea58d2d696417fa933cd270c20e197f531fc1b4be5e340dc416129f8b4f5fa2f0d2d0cf51850928340a
languageName: node
linkType: hard

"@types/minimatch@npm:^5.1.2":
version: 5.1.2
resolution: "@types/minimatch@npm:5.1.2"
Expand Down Expand Up @@ -2905,6 +2914,13 @@ __metadata:
languageName: node
linkType: hard

"@types/unist@npm:*, @types/unist@npm:^3.0.0":
version: 3.0.0
resolution: "@types/unist@npm:3.0.0"
checksum: e9d21a8fb5e332be0acef29192d82632875b2ef3e700f1bc64fdfc1520189542de85c3d4f3bcfbc2f4afdb210f4c23f68061f3fbf10744e920d4f18430d19f49
languageName: node
linkType: hard

"@types/unist@npm:^2, @types/unist@npm:^2.0.0":
version: 2.0.8
resolution: "@types/unist@npm:2.0.8"
Expand Down Expand Up @@ -4949,6 +4965,15 @@ __metadata:
languageName: node
linkType: hard

"devlop@npm:^1.0.0":
version: 1.1.0
resolution: "devlop@npm:1.1.0"
dependencies:
dequal: ^2.0.0
checksum: d2ff650bac0bb6ef08c48f3ba98640bb5fec5cce81e9957eb620408d1bab1204d382a45b785c6b3314dc867bb0684936b84c6867820da6db97cbb5d3c15dd185
languageName: node
linkType: hard

"diff-sequences@npm:^29.6.3":
version: 29.6.3
resolution: "diff-sequences@npm:29.6.3"
Expand Down Expand Up @@ -8755,6 +8780,18 @@ __metadata:
languageName: node
linkType: hard

"mdast-util-find-and-replace@npm:^3.0.0":
version: 3.0.1
resolution: "mdast-util-find-and-replace@npm:3.0.1"
dependencies:
"@types/mdast": ^4.0.0
escape-string-regexp: ^5.0.0
unist-util-is: ^6.0.0
unist-util-visit-parents: ^6.0.0
checksum: 05d5c4ff02e31db2f8a685a13bcb6c3f44e040bd9dfa54c19a232af8de5268334c8755d79cb456ed4cced1300c4fb83e88444c7ae8ee9ff16869a580f29d08cd
languageName: node
linkType: hard

"mdast-util-from-markdown@npm:^1.0.0":
version: 1.3.1
resolution: "mdast-util-from-markdown@npm:1.3.1"
Expand Down Expand Up @@ -8845,6 +8882,16 @@ __metadata:
languageName: node
linkType: hard

"mdast-util-newline-to-break@npm:^2.0.0":
version: 2.0.0
resolution: "mdast-util-newline-to-break@npm:2.0.0"
dependencies:
"@types/mdast": ^4.0.0
mdast-util-find-and-replace: ^3.0.0
checksum: 91e235e3629a83d6b7f1d713297da9f7fc394b1c88f2859f775bee78cd8de6a84d8657edac5f7b1fecfc07e4b5d06233f64f61e895b76642f1612530b2d7d88a
languageName: node
linkType: hard

"mdast-util-phrasing@npm:^3.0.0":
version: 3.0.1
resolution: "mdast-util-phrasing@npm:3.0.1"
Expand Down Expand Up @@ -10832,6 +10879,17 @@ __metadata:
languageName: node
linkType: hard

"remark-breaks@npm:4.0.0":
version: 4.0.0
resolution: "remark-breaks@npm:4.0.0"
dependencies:
"@types/mdast": ^4.0.0
mdast-util-newline-to-break: ^2.0.0
unified: ^11.0.0
checksum: 222883db314a2842fa0a5f59a571b66df722c6bdf284938a7463e892228820b72d6827b38b55de8f87577a50a1c4b7502573b0e6a403003815c210a18fd04a51
languageName: node
linkType: hard

"remark-gfm@npm:3.0.1":
version: 3.0.1
resolution: "remark-gfm@npm:3.0.1"
Expand Down Expand Up @@ -11159,6 +11217,7 @@ __metadata:
redux: 4.2.1
redux-devtools-extension: 2.13.9
redux-thunk: 2.4.2
remark-breaks: 4.0.0
remark-gfm: 3.0.1
stylelint: 15.10.3
stylelint-config-standard: 34.0.0
Expand Down Expand Up @@ -12406,6 +12465,21 @@ __metadata:
languageName: node
linkType: hard

"unified@npm:^11.0.0":
version: 11.0.3
resolution: "unified@npm:11.0.3"
dependencies:
"@types/unist": ^3.0.0
bail: ^2.0.0
devlop: ^1.0.0
extend: ^3.0.0
is-plain-obj: ^4.0.0
trough: ^2.0.0
vfile: ^6.0.0
checksum: 402d6b397b98f8966993faca0e1480f5f1825cc44df6a5236b75ab099f14b10ed808e578155c3f535e60676c12ee3f52346ca08d64343a72181d7a6b4d32011d
languageName: node
linkType: hard

"union-value@npm:^1.0.0":
version: 1.0.1
resolution: "union-value@npm:1.0.1"
Expand Down Expand Up @@ -12452,6 +12526,15 @@ __metadata:
languageName: node
linkType: hard

"unist-util-is@npm:^6.0.0":
version: 6.0.0
resolution: "unist-util-is@npm:6.0.0"
dependencies:
"@types/unist": ^3.0.0
checksum: f630a925126594af9993b091cf807b86811371e465b5049a6283e08537d3e6ba0f7e248e1e7dab52cfe33f9002606acef093441137181b327f6fe504884b20e2
languageName: node
linkType: hard

"unist-util-position@npm:^4.0.0":
version: 4.0.4
resolution: "unist-util-position@npm:4.0.4"
Expand All @@ -12470,6 +12553,15 @@ __metadata:
languageName: node
linkType: hard

"unist-util-stringify-position@npm:^4.0.0":
version: 4.0.0
resolution: "unist-util-stringify-position@npm:4.0.0"
dependencies:
"@types/unist": ^3.0.0
checksum: e2e7aee4b92ddb64d314b4ac89eef7a46e4c829cbd3ee4aee516d100772b490eb6b4974f653ba0717a0071ca6ea0770bf22b0a2ea62c65fcba1d071285e96324
languageName: node
linkType: hard

"unist-util-visit-parents@npm:^5.0.0, unist-util-visit-parents@npm:^5.1.1":
version: 5.1.3
resolution: "unist-util-visit-parents@npm:5.1.3"
Expand All @@ -12480,6 +12572,16 @@ __metadata:
languageName: node
linkType: hard

"unist-util-visit-parents@npm:^6.0.0":
version: 6.0.1
resolution: "unist-util-visit-parents@npm:6.0.1"
dependencies:
"@types/unist": ^3.0.0
unist-util-is: ^6.0.0
checksum: 08927647c579f63b91aafcbec9966dc4a7d0af1e5e26fc69f4e3e6a01215084835a2321b06f3cbe7bf7914a852830fc1439f0fc3d7153d8804ac3ef851ddfa20
languageName: node
linkType: hard

"unist-util-visit@npm:^4.0.0":
version: 4.1.2
resolution: "unist-util-visit@npm:4.1.2"
Expand Down Expand Up @@ -12693,6 +12795,16 @@ __metadata:
languageName: node
linkType: hard

"vfile-message@npm:^4.0.0":
version: 4.0.2
resolution: "vfile-message@npm:4.0.2"
dependencies:
"@types/unist": ^3.0.0
unist-util-stringify-position: ^4.0.0
checksum: 964e7e119f4c0e0270fc269119c41c96da20afa01acb7c9809a88365c8e0c64aa692fafbd952669382b978002ecd7ad31ef4446d85e8a22cdb62f6df20186c2d
languageName: node
linkType: hard

"vfile@npm:^5.0.0":
version: 5.3.7
resolution: "vfile@npm:5.3.7"
Expand All @@ -12705,6 +12817,17 @@ __metadata:
languageName: node
linkType: hard

"vfile@npm:^6.0.0":
version: 6.0.1
resolution: "vfile@npm:6.0.1"
dependencies:
"@types/unist": ^3.0.0
unist-util-stringify-position: ^4.0.0
vfile-message: ^4.0.0
checksum: 05ccee73aeb00402bc8a5d0708af299e9f4a33f5132805449099295085e3ca3b0d018328bad9ff44cf2e6f4cd364f1d558d3fb9b394243a25b2739207edcb0ed
languageName: node
linkType: hard

"victory-vendor@npm:^36.6.8":
version: 36.6.11
resolution: "victory-vendor@npm:36.6.11"
Expand Down