@oxide/design-system 6.4.1-canary.fec0981 → 6.5.0

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.
@@ -35,6 +35,7 @@ declare const attrs: {
35
35
  sectlinks: string;
36
36
  stem: string;
37
37
  stylesheet: boolean;
38
+ icons: string;
38
39
  };
39
40
  declare const loadAsciidoctor: ({ extensions, }: {
40
41
  extensions?: ((this: Registry) => void)[];
@@ -9,7 +9,7 @@ import {
9
9
  // components/src/asciidoc/index.tsx
10
10
  import {
11
11
  Content as Content4,
12
- inlineHtml,
12
+ inlineHtml as inlineHtml2,
13
13
  parse as parse3
14
14
  } from "@oxide/react-asciidoc";
15
15
 
@@ -87,16 +87,28 @@ var Warning12 = ({ className }) => /* @__PURE__ */ jsx(
87
87
  var Admonition_default = Admonition;
88
88
 
89
89
  // components/src/asciidoc/Section.tsx
90
- import { Content as Content2, parse, RenderInline as RenderInline2 } from "@oxide/react-asciidoc";
90
+ import {
91
+ Content as Content2,
92
+ inlineHtml,
93
+ parse,
94
+ RenderInline as RenderInline2
95
+ } from "@oxide/react-asciidoc";
91
96
  import cn from "classnames";
92
97
  import { createElement } from "react";
93
98
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
99
+ var dropAnchorTags = (html) => html?.includes("<a") ? html.replace(/<(?:a\b[^>]*|\/a)>/g, "") : html;
100
+ var stripLinks = (nodes) => nodes.flatMap((node) => {
101
+ if (node.type === "anchor") return stripLinks(node.text);
102
+ if (node.type === "footnote")
103
+ return [{ type: "text", text: dropAnchorTags(inlineHtml([node]).__html), raw: true }];
104
+ return [node];
105
+ });
94
106
  var Section = ({ node }) => {
95
107
  const level = node.level;
96
108
  let title = "";
97
109
  let sectNum = node.num;
98
110
  sectNum = sectNum && sectNum[0] === "." ? "" : sectNum;
99
- const titleContent = node.hasCaption ? parse(node.title) : /* @__PURE__ */ jsx2(RenderInline2, { nodes: node.titleInlines });
111
+ const titleContent = node.hasCaption ? parse(dropAnchorTags(node.title)) : /* @__PURE__ */ jsx2(RenderInline2, { nodes: node.titleInlines && stripLinks(node.titleInlines) });
100
112
  title = /* @__PURE__ */ jsxs2(Fragment, { children: [
101
113
  /* @__PURE__ */ jsx2("span", { className: "anchor", id: node.id || "", "aria-hidden": "true" }),
102
114
  /* @__PURE__ */ jsxs2("a", { className: "link group", href: `#${node.id}`, children: [
@@ -109,10 +121,15 @@ var Section = ({ node }) => {
109
121
  /* @__PURE__ */ jsx2("h1", { className: cn("sect0", node.role), "data-sectnum": sectNum, children: title }),
110
122
  /* @__PURE__ */ jsx2(Content2, { blocks: node.blocks })
111
123
  ] });
124
+ } else if (level === 1) {
125
+ return /* @__PURE__ */ jsxs2("div", { className: cn("sect1", node.role), children: [
126
+ createElement("h2", { "data-sectnum": sectNum }, title),
127
+ /* @__PURE__ */ jsx2("div", { className: "sectionbody", children: /* @__PURE__ */ jsx2(Content2, { blocks: node.blocks }) })
128
+ ] });
112
129
  } else {
113
130
  return /* @__PURE__ */ jsxs2("div", { className: cn(`sect${level}`, node.role), children: [
114
131
  createElement(`h${level + 1}`, { "data-sectnum": sectNum }, title),
115
- /* @__PURE__ */ jsx2("div", { className: "sectionbody", children: /* @__PURE__ */ jsx2(Content2, { blocks: node.blocks }) })
132
+ /* @__PURE__ */ jsx2(Content2, { blocks: node.blocks })
116
133
  ] });
117
134
  }
118
135
  };
@@ -2035,12 +2052,12 @@ async function highlightCode(code, lang, { inline = false } = {}) {
2035
2052
  var highlight = async (block) => {
2036
2053
  if (block.type === "listing") {
2037
2054
  const literalBlock = block;
2038
- if (!literalBlock.content || typeof literalBlock.content !== "string") {
2055
+ if (typeof literalBlock.source !== "string") {
2039
2056
  return block;
2040
2057
  }
2041
2058
  const lineComment = literalBlock.attributes["line-comment"];
2042
- const content = Inline.subCallouts(
2043
- literalBlock.content,
2059
+ const content = Inline.subCalloutsRaw(
2060
+ literalBlock.source,
2044
2061
  true,
2045
2062
  lineComment !== void 0 ? String(lineComment) : void 0
2046
2063
  );
@@ -2048,13 +2065,13 @@ var highlight = async (block) => {
2048
2065
  const callouts = [];
2049
2066
  const placeholderContent = content.replace(calloutRegex, (match) => {
2050
2067
  callouts.push(match);
2051
- return `__CALLOUT_PLACEHOLDER_${callouts.length - 1}__`;
2068
+ return `CALLOUTPLACEHOLDER${callouts.length - 1}END`;
2052
2069
  });
2053
2070
  if (!literalBlock.language) {
2054
2071
  return {
2055
2072
  ...block,
2056
- content: placeholderContent.replace(
2057
- /__CALLOUT_PLACEHOLDER_(\d+)__/g,
2073
+ content: Inline.subSpecialchars(placeholderContent).replace(
2074
+ /CALLOUTPLACEHOLDER(\d+)END/g,
2058
2075
  (_, index) => callouts[parseInt(index)]
2059
2076
  )
2060
2077
  };
@@ -2065,7 +2082,7 @@ var highlight = async (block) => {
2065
2082
  { inline: true }
2066
2083
  );
2067
2084
  const restoredContent = highlightedContent.replace(
2068
- /__CALLOUT_PLACEHOLDER_(\d+)__/g,
2085
+ /CALLOUTPLACEHOLDER(\d+)END/g,
2069
2086
  (_, index) => callouts[parseInt(index)]
2070
2087
  );
2071
2088
  return {
@@ -2078,7 +2095,8 @@ var highlight = async (block) => {
2078
2095
  var attrs = {
2079
2096
  sectlinks: "true",
2080
2097
  stem: "latexmath",
2081
- stylesheet: false
2098
+ stylesheet: false,
2099
+ icons: "font"
2082
2100
  };
2083
2101
  var loadAsciidoctor = ({
2084
2102
  extensions = []
@@ -2111,7 +2129,7 @@ var renderWithBreaks = (text) => {
2111
2129
  };
2112
2130
  var inlineOverrides = {
2113
2131
  quoted: ({ node }) => {
2114
- let { __html } = inlineHtml([node]);
2132
+ let { __html } = inlineHtml2([node]);
2115
2133
  if (node.subtype === "monospaced") {
2116
2134
  __html = renderWithBreaks(__html);
2117
2135
  }