@burdenoff/website-sdk 2026.720.5 → 2026.720.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,10 @@ import { cva } from 'class-variance-authority';
10
10
  import { clsx } from 'clsx';
11
11
  import { twMerge } from 'tailwind-merge';
12
12
  import * as LabelPrimitive from '@radix-ui/react-label';
13
+ import DOMPurify from 'isomorphic-dompurify';
14
+ import ReactMarkdown from 'react-markdown';
15
+ import rehypeSanitize from 'rehype-sanitize';
16
+ import remarkGfm from 'remark-gfm';
13
17
 
14
18
  var __defProp = Object.defineProperty;
15
19
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -813,43 +817,40 @@ function ContactPage({
813
817
  ] }) })
814
818
  ] });
815
819
  }
816
- function renderMarkdown(md) {
817
- let html = md;
818
- html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
819
- html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
820
- return `<pre><code>${code.trim()}</code></pre>`;
821
- });
822
- html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
823
- html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
824
- html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
825
- html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
826
- html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
827
- html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
828
- html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
829
- html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
830
- html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
831
- html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
832
- html = html.replace(
833
- /\[([^\]]+)\]\(([^)]+)\)/g,
834
- '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
820
+ var defaultComponents = {
821
+ a: ({ href, children, ...props }) => {
822
+ const isExternal = typeof href === "string" && (href.startsWith("http://") || href.startsWith("https://"));
823
+ return /* @__PURE__ */ jsx(
824
+ "a",
825
+ {
826
+ href,
827
+ ...props,
828
+ ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : { rel: "noopener noreferrer" },
829
+ children
830
+ }
831
+ );
832
+ }
833
+ };
834
+ function Markdown({
835
+ children,
836
+ className,
837
+ inline,
838
+ components
839
+ }) {
840
+ const content = /* @__PURE__ */ jsx(
841
+ ReactMarkdown,
842
+ {
843
+ remarkPlugins: [remarkGfm],
844
+ rehypePlugins: [rehypeSanitize],
845
+ components: { ...defaultComponents, ...components },
846
+ ...inline ? { disallowedElements: ["p"], unwrapDisallowed: true } : {},
847
+ children
848
+ }
835
849
  );
836
- html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
837
- html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
838
- const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
839
- return `<ul>${items}</ul>`;
840
- });
841
- html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
842
- const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
843
- return `<ol>${items}</ol>`;
844
- });
845
- html = html.replace(/^---$/gm, "<hr />");
846
- html = html.split(/\n\n+/).map((block) => {
847
- const trimmed = block.trim();
848
- if (!trimmed) return "";
849
- if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
850
- return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
851
- }).join("\n");
852
- return html;
850
+ if (inline) {
851
+ return /* @__PURE__ */ jsx("span", { className, children: content });
852
+ }
853
+ return /* @__PURE__ */ jsx("div", { className, children: content });
853
854
  }
854
855
  function ContentRenderer({
855
856
  content,
@@ -857,20 +858,15 @@ function ContentRenderer({
857
858
  className
858
859
  }) {
859
860
  if (format === "markdown") {
860
- return /* @__PURE__ */ jsx(
861
- "div",
862
- {
863
- className,
864
- dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
865
- }
866
- );
861
+ return /* @__PURE__ */ jsx(Markdown, { className, children: content });
867
862
  }
868
863
  if (format === "html") {
864
+ const sanitized = DOMPurify.sanitize(content);
869
865
  return /* @__PURE__ */ jsx(
870
866
  "div",
871
867
  {
872
868
  className,
873
- dangerouslySetInnerHTML: { __html: content }
869
+ dangerouslySetInnerHTML: { __html: sanitized }
874
870
  }
875
871
  );
876
872
  }