mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix markdown with remark-breaks
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
"react-scripts": "5.0.1",
|
||||
"react-toastify": "^9.1.1",
|
||||
"react-tooltip": "^5.10.0",
|
||||
"remark-breaks": "^3.0.2",
|
||||
"styled-components": "^5.3.9",
|
||||
"web-vitals": "^3.3.0",
|
||||
"zustand": "^4.3.6"
|
||||
|
||||
+2
-18
@@ -2,21 +2,7 @@ import React from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import { Link } from 'react-router-dom';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
const removeExtraNewlines = () => (tree) => {
|
||||
let lastNodeWasNewline = false;
|
||||
tree.children = tree.children.filter((node) => {
|
||||
if (node.type === 'br') {
|
||||
if (lastNodeWasNewline) {
|
||||
return false;
|
||||
}
|
||||
lastNodeWasNewline = true;
|
||||
} else {
|
||||
lastNodeWasNewline = false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
import breaks from 'remark-breaks';
|
||||
|
||||
|
||||
const blockquoteToGreentext = () => (tree) => {
|
||||
@@ -72,16 +58,14 @@ const Post = ({ content, handlequoteclick, comment }) => {
|
||||
return (
|
||||
<ReactMarkdown
|
||||
children={sanitizedContent}
|
||||
remarkPlugins={[blockquoteToGreentext, removeExtraNewlines]}
|
||||
remarkPlugins={[blockquoteToGreentext, breaks]}
|
||||
components={{
|
||||
img: () => null,
|
||||
video: () => null,
|
||||
source: () => null,
|
||||
gif: () => null,
|
||||
p: ({ children }) => <div className="custom-paragraph">{children}</div>,
|
||||
br: () => <br className="custom-linebreak" />,
|
||||
}}
|
||||
className='line-break'
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2459,48 +2459,6 @@
|
||||
ts-custom-error "3.3.1"
|
||||
uuid "9.0.0"
|
||||
|
||||
"@plebbit/plebbit-js@https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82":
|
||||
version "0.0.3"
|
||||
resolved "https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82"
|
||||
dependencies:
|
||||
"@keyv/sqlite" "3.6.2"
|
||||
"@plebbit/plebbit-logger" "github:plebbit/plebbit-logger"
|
||||
"@types/node-fetch" "2.6.2"
|
||||
"@types/proper-lockfile" "4.1.2"
|
||||
"@types/uuid" "8.3.4"
|
||||
assert "2.0.0"
|
||||
async-wait-until "2.0.12"
|
||||
buffer "6.0.3"
|
||||
captcha-canvas "3.2.1"
|
||||
err-code "3.0.1"
|
||||
ethers "5.7.2"
|
||||
file-type "16.5.4"
|
||||
form-data "4.0.0"
|
||||
hpagent "1.2.0"
|
||||
ipfs-http-client "56.0.3"
|
||||
ipfs-only-hash "4.0.0"
|
||||
is-ipfs "6.0.2"
|
||||
jose "4.11.0"
|
||||
js-sha256 "0.9.0"
|
||||
keyv "4.5.2"
|
||||
knex "2.3.0"
|
||||
libp2p-crypto "0.21.2"
|
||||
limiter "2.1.0"
|
||||
localforage "1.10.0"
|
||||
lodash-es "4.17.21"
|
||||
open-graph-scraper "5.2.3"
|
||||
p-limit "3.1.0"
|
||||
peer-id "0.16.0"
|
||||
proper-lockfile "github:plebbit/node-proper-lockfile"
|
||||
retry "0.13.1"
|
||||
safe-stable-stringify "2.4.1"
|
||||
skia-canvas "1.0.0"
|
||||
sqlite3 "5.1.2"
|
||||
tiny-typed-emitter "2.1.0"
|
||||
tinycache "1.1.2"
|
||||
ts-custom-error "3.3.1"
|
||||
uuid "9.0.0"
|
||||
|
||||
"@plebbit/plebbit-logger@github:plebbit/plebbit-logger":
|
||||
version "0.0.1"
|
||||
uid "9525ca9539479918931c3b334e8d490d1c87e507"
|
||||
@@ -2514,21 +2472,6 @@
|
||||
dependencies:
|
||||
debug "4.3.3"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#11b519a6ad7a9b96911b2ebb4b7f13cddf5233d5":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#11b519a6ad7a9b96911b2ebb4b7f13cddf5233d5"
|
||||
dependencies:
|
||||
"@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82"
|
||||
"@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git"
|
||||
assert "2.0.0"
|
||||
ethers "5.6.9"
|
||||
localforage "1.10.0"
|
||||
lodash.isequal "4.5.0"
|
||||
memoizee "0.4.15"
|
||||
quick-lru "5.1.1"
|
||||
uuid "8.3.2"
|
||||
zustand "4.0.0"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#604eab550a9c480cee42bf414581c624ec316f27":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#604eab550a9c480cee42bf414581c624ec316f27"
|
||||
@@ -11098,6 +11041,15 @@ relateurl@^0.2.7:
|
||||
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
||||
integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==
|
||||
|
||||
remark-breaks@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/remark-breaks/-/remark-breaks-3.0.2.tgz#f466b9d3474d7323146c0149fc1496dabadd908e"
|
||||
integrity sha512-x96YDJ9X+Ry0/JNZFKfr1hpcAKvGYWfUTszxY9RbxKEqq6uzPPoLCuHdZsLPZZUdAv3nCROyc7FPrQLWr2rxyw==
|
||||
dependencies:
|
||||
"@types/mdast" "^3.0.0"
|
||||
unified "^10.0.0"
|
||||
unist-util-visit "^4.0.0"
|
||||
|
||||
remark-parse@^10.0.0:
|
||||
version "10.0.1"
|
||||
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-10.0.1.tgz#6f60ae53edbf0cf38ea223fe643db64d112e0775"
|
||||
|
||||
Reference in New Issue
Block a user