import { Fragment } from "react";
// Render a small, safe subset of Discord Markdown; React escapes raw HTML.
function inline(text: string) {
return text
.split(/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\(https?:\/\/[^\s)]+\))/g)
.map((part, i) => {
if (part.startsWith("**") && part.endsWith("**"))
return {part.slice(2, -2)};
if (part.startsWith("`") && part.endsWith("`"))
return {part.slice(1, -1)};
const link = /^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(part);
if (link)
return (
{link[1]}
);
return
{lines.map((line, j) => (
}
{inline(line)}