@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.
@@ -11,6 +11,10 @@ var classVarianceAuthority = require('class-variance-authority');
11
11
  var clsx = require('clsx');
12
12
  var tailwindMerge = require('tailwind-merge');
13
13
  var LabelPrimitive = require('@radix-ui/react-label');
14
+ var DOMPurify = require('isomorphic-dompurify');
15
+ var ReactMarkdown = require('react-markdown');
16
+ var rehypeSanitize = require('rehype-sanitize');
17
+ var remarkGfm = require('remark-gfm');
14
18
 
15
19
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
20
 
@@ -35,6 +39,10 @@ function _interopNamespace(e) {
35
39
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
40
  var ReCAPTCHA__default = /*#__PURE__*/_interopDefault(ReCAPTCHA);
37
41
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
42
+ var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
43
+ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
44
+ var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
45
+ var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
38
46
 
39
47
  var __defProp = Object.defineProperty;
40
48
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -838,43 +846,40 @@ function ContactPage({
838
846
  ] }) })
839
847
  ] });
840
848
  }
841
- function renderMarkdown(md) {
842
- let html = md;
843
- html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
844
- html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
845
- return `<pre><code>${code.trim()}</code></pre>`;
846
- });
847
- html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
848
- html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
849
- html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
850
- html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
851
- html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
852
- html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
853
- html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
854
- html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
855
- html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
856
- html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
857
- html = html.replace(
858
- /\[([^\]]+)\]\(([^)]+)\)/g,
859
- '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
849
+ var defaultComponents = {
850
+ a: ({ href, children, ...props }) => {
851
+ const isExternal = typeof href === "string" && (href.startsWith("http://") || href.startsWith("https://"));
852
+ return /* @__PURE__ */ jsxRuntime.jsx(
853
+ "a",
854
+ {
855
+ href,
856
+ ...props,
857
+ ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : { rel: "noopener noreferrer" },
858
+ children
859
+ }
860
+ );
861
+ }
862
+ };
863
+ function Markdown({
864
+ children,
865
+ className,
866
+ inline,
867
+ components
868
+ }) {
869
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
870
+ ReactMarkdown__default.default,
871
+ {
872
+ remarkPlugins: [remarkGfm__default.default],
873
+ rehypePlugins: [rehypeSanitize__default.default],
874
+ components: { ...defaultComponents, ...components },
875
+ ...inline ? { disallowedElements: ["p"], unwrapDisallowed: true } : {},
876
+ children
877
+ }
860
878
  );
861
- html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
862
- html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
863
- const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
864
- return `<ul>${items}</ul>`;
865
- });
866
- html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
867
- const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
868
- return `<ol>${items}</ol>`;
869
- });
870
- html = html.replace(/^---$/gm, "<hr />");
871
- html = html.split(/\n\n+/).map((block) => {
872
- const trimmed = block.trim();
873
- if (!trimmed) return "";
874
- if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
875
- return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
876
- }).join("\n");
877
- return html;
879
+ if (inline) {
880
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: content });
881
+ }
882
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: content });
878
883
  }
879
884
  function ContentRenderer({
880
885
  content,
@@ -882,20 +887,15 @@ function ContentRenderer({
882
887
  className
883
888
  }) {
884
889
  if (format === "markdown") {
885
- return /* @__PURE__ */ jsxRuntime.jsx(
886
- "div",
887
- {
888
- className,
889
- dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
890
- }
891
- );
890
+ return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { className, children: content });
892
891
  }
893
892
  if (format === "html") {
893
+ const sanitized = DOMPurify__default.default.sanitize(content);
894
894
  return /* @__PURE__ */ jsxRuntime.jsx(
895
895
  "div",
896
896
  {
897
897
  className,
898
- dangerouslySetInnerHTML: { __html: content }
898
+ dangerouslySetInnerHTML: { __html: sanitized }
899
899
  }
900
900
  );
901
901
  }