Skip to content

Commit

Permalink
fix(web): Single linebreaks are lost when viewing textnote card. Fixes
Browse files Browse the repository at this point in the history
…#549 (#551)

added remarkBreaks plugin to properly handle single newlines
  • Loading branch information
kamtschatka authored Oct 19, 2024
1 parent 4454d63 commit 6977ba7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/web/components/ui/markdown-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { cn } from "@/lib/utils";
import Markdown from "react-markdown";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/prism";
import remarkBreaks from "remark-breaks";
import remarkGfm from "remark-gfm";

function PreWithCopyBtn({ className, ...props }: React.ComponentProps<"pre">) {
Expand All @@ -28,7 +29,7 @@ export function MarkdownComponent({
}) {
return (
<Markdown
remarkPlugins={[remarkGfm]}
remarkPlugins={[remarkGfm, remarkBreaks]}
className="prose dark:prose-invert"
components={{
pre({ ...props }) {
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"react-masonry-css": "^1.0.16",
"react-select": "^5.8.0",
"react-syntax-highlighter": "^15.5.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"sharp": "^0.33.3",
"superjson": "^2.2.1",
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6977ba7

Please sign in to comment.