mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
feat: changelog now supports markdown within entries
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { cn } from "@/utils/ui";
|
import { cn } from "@/utils/ui";
|
||||||
|
import { ReactMarkdownWrapper } from "@/components/ui/react-markdown-wrapper";
|
||||||
import {
|
import {
|
||||||
getSectionTitle,
|
getSectionTitle,
|
||||||
groupAndOrderChanges,
|
groupAndOrderChanges,
|
||||||
@@ -144,7 +145,7 @@ function ReleaseChangeList({
|
|||||||
key={change.text}
|
key={change.text}
|
||||||
className="text-base leading-relaxed text-foreground"
|
className="text-base leading-relaxed text-foreground"
|
||||||
>
|
>
|
||||||
{change.text}
|
<ReactMarkdownWrapper inline>{change.text}</ReactMarkdownWrapper>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import { cn } from "@/utils/ui";
|
import { cn } from "@/utils/ui";
|
||||||
|
|
||||||
export function ReactMarkdownWrapper({ children }: { children: string }) {
|
export function ReactMarkdownWrapper({
|
||||||
|
children,
|
||||||
|
inline = false,
|
||||||
|
}: {
|
||||||
|
children: string;
|
||||||
|
inline?: boolean;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
components={{
|
components={{
|
||||||
@@ -18,6 +24,27 @@ export function ReactMarkdownWrapper({ children }: { children: string }) {
|
|||||||
strong: ({ children }) => (
|
strong: ({ children }) => (
|
||||||
<strong className="text-foreground font-semibold">{children}</strong>
|
<strong className="text-foreground font-semibold">{children}</strong>
|
||||||
),
|
),
|
||||||
|
code: ({ className: codeClassName, children, ...props }) => (
|
||||||
|
<code
|
||||||
|
className={cn(
|
||||||
|
"rounded border border-destructive/20 bg-destructive/5 px-1.5 py-0.5 font-mono text-[0.85em] text-red-700 dark:text-red-300",
|
||||||
|
codeClassName,
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</code>
|
||||||
|
),
|
||||||
|
p: ({ className: paragraphClassName, children, ...props }) =>
|
||||||
|
inline ? (
|
||||||
|
<span className={cn("m-0", paragraphClassName)} {...props}>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<p className={cn("m-0", paragraphClassName)} {...props}>
|
||||||
|
{children}
|
||||||
|
</p>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user