@mintlify/common 1.0.1327 → 1.0.1329

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.
@@ -1,3 +1,8 @@
1
1
  /** Label for a link that follows block content when nothing names its target. */
2
2
  export declare const BLOCK_LINK_LABEL = "Open";
3
- export declare const FIRST_PARTY_MARKDOWN_COMPONENT_SOURCE = "\nexport const Note = ({ children }) => <blockquote>{\"[!NOTE]\\n\\n\"}{children}</blockquote>;\n\nexport const Info = ({ children }) => <blockquote>{\"[!NOTE]\\n\\n\"}{children}</blockquote>;\n\nexport const Tip = ({ children }) => <blockquote>{\"[!TIP]\\n\\n\"}{children}</blockquote>;\n\nexport const Check = ({ children }) => <blockquote>{\"[!TIP]\\n\\n\"}{children}</blockquote>;\n\nexport const Warning = ({ children }) => <blockquote>{\"[!WARNING]\\n\\n\"}{children}</blockquote>;\n\nexport const Danger = ({ children }) => <blockquote>{\"[!CAUTION]\\n\\n\"}{children}</blockquote>;\n\nexport const Card = ({ title = \"\", href = \"\", description = \"\", children }) => title === \"\" ? <blockquote>{(children ?? \"\") === \"\" ? description : children}{href === \"\" ? \"\" : <>{\"\\n\\n\"}<a href={href}>Open</a></>}</blockquote> : <blockquote><strong><a href={href}>{title}</a></strong>{\"\\n\\n\"}{(children ?? \"\") === \"\" ? description : children}</blockquote>;\n\nexport const Accordion = ({ title = \"\", description = \"\", children }) => <blockquote>{title === \"\" ? \"\" : <><strong>{title}</strong>{\"\\n\\n\"}</>}{description === \"\" ? \"\" : <>{description}{\"\\n\\n\"}</>}{children}</blockquote>;\n\nexport const ParamField = ({ path = \"\", body = \"\", query = \"\", header = \"\", type = \"\", required = false, deprecated = false, default: defaultValue = \"\", children }) => (path || body || query || header) === \"\" ? <>{children}</> : <>{\"**\" + (path || body || query || header) + \"**\"}{type === \"\" ? \"\" : \" \\`\" + type + \"\\`\"}{required ? \" *required*\" : \"\"}{deprecated ? \" *deprecated*\" : \"\"}{defaultValue === \"\" ? \"\" : \" (default: \" + defaultValue + \")\"}{\"\\n\\n\"}{children}</>;\n\nexport const ResponseField = ({ name = \"\", type = \"\", required = false, deprecated = false, default: defaultValue = \"\", children }) => name === \"\" ? <>{children}</> : <>{\"**\" + name + \"**\"}{type === \"\" ? \"\" : \" \\`\" + type + \"\\`\"}{required ? \" *required*\" : \"\"}{deprecated ? \" *deprecated*\" : \"\"}{defaultValue === \"\" ? \"\" : \" (default: \" + defaultValue + \")\"}{\"\\n\\n\"}{children}</>;\n\nexport const Steps = ({ children }) => <>{children}</>;\n\nexport const Step = ({ title = \"\", stepNumber = 1, titleSize = \"p\", children }) => <>{\"\\n\\n\"}{titleSize === \"h2\" ? \"## \" : titleSize === \"h3\" ? \"### \" : titleSize === \"h4\" ? \"#### \" : \"**\"}{title === \"\" ? \"Step \" + stepNumber : stepNumber + \". \" + title}{titleSize === \"h2\" || titleSize === \"h3\" || titleSize === \"h4\" ? \"\" : \"**\"}{\"\\n\\n\"}{children}{\"\\n\\n\"}</>;\n\nexport const Tooltip = ({ tip = \"\", children }) => tip === \"\" ? <>{children}</> : <>{children}{\" (\" + tip + \")\"}</>;\n\nexport const Frame = ({ caption = \"\", children }) => caption === \"\" ? <>{children}</> : <>{children}{\"\\n\\n\"}{caption}</>;\n\nexport const Update = ({ label = \"\", description = \"\", children }) => <>{label === \"\" ? \"\" : <><strong>{label}</strong>{\"\\n\\n\"}</>}{description === \"\" ? \"\" : <>{description}{\"\\n\\n\"}</>}{children}</>;\n\nexport const Tile = ({ href = \"\", title = \"\", \"aria-label\": ariaLabel = \"\", description = \"\", children }) => <>{(title || ariaLabel) === \"\" ? \"\" : href === \"\" ? <><strong>{title || ariaLabel}</strong>{\"\\n\\n\"}</> : <><a href={href}>{title || ariaLabel}</a>{\"\\n\\n\"}</>}{description === \"\" ? \"\" : <>{description}{\"\\n\\n\"}</>}{children}</>;\n\nexport const Prompt = ({ description = \"\", children }) => <>{description === \"\" ? \"\" : <>{description}{\"\\n\\n\"}</>}{children}</>;\n\nexport const Color_Item = ({ name = \"\", value = \"\" }) => <>{name === \"\" ? \"\" : \"**\" + name + \"** \"}{typeof value === \"string\" ? \"\\`\" + value + \"\\`\" : \"\\`\" + value.light + \"\\` (light), \\`\" + value.dark + \"\\` (dark)\"}{\"\\n\\n\"}</>;\n";
3
+ export declare const BLOCK_MARKERS: {
4
+ readonly Tab: '[tab]';
5
+ readonly Card: '[card]';
6
+ readonly Accordion: '[accordion]';
7
+ };
8
+ export declare const FIRST_PARTY_MARKDOWN_COMPONENT_SOURCE: string;
@@ -1,5 +1,10 @@
1
1
  /** Label for a link that follows block content when nothing names its target. */
2
2
  export const BLOCK_LINK_LABEL = 'Open';
3
+ export const BLOCK_MARKERS = {
4
+ Tab: '[tab]',
5
+ Card: '[card]',
6
+ Accordion: '[accordion]',
7
+ };
3
8
  export const FIRST_PARTY_MARKDOWN_COMPONENT_SOURCE = `
4
9
  export const Note = ({ children }) => <blockquote>{"[!NOTE]\\n\\n"}{children}</blockquote>;
5
10
 
@@ -13,14 +18,16 @@ export const Warning = ({ children }) => <blockquote>{"[!WARNING]\\n\\n"}{childr
13
18
 
14
19
  export const Danger = ({ children }) => <blockquote>{"[!CAUTION]\\n\\n"}{children}</blockquote>;
15
20
 
16
- export const Card = ({ title = "", href = "", description = "", children }) => title === "" ? <blockquote>{(children ?? "") === "" ? description : children}{href === "" ? "" : <>{"\\n\\n"}<a href={href}>${BLOCK_LINK_LABEL}</a></>}</blockquote> : <blockquote><strong><a href={href}>{title}</a></strong>{"\\n\\n"}{(children ?? "") === "" ? description : children}</blockquote>;
21
+ export const Card = ({ title = "", href = "", description = "", children }) => <blockquote>{"${BLOCK_MARKERS.Card}"}{title === "" ? "" : <>{" "}<a href={href}>{title}</a></>}{"\\n\\n"}{(children ?? "") === "" ? description : children}{title !== "" || href === "" ? "" : <>{"\\n\\n"}<a href={href}>${BLOCK_LINK_LABEL}</a></>}</blockquote>;
17
22
 
18
- export const Accordion = ({ title = "", description = "", children }) => <blockquote>{title === "" ? "" : <><strong>{title}</strong>{"\\n\\n"}</>}{description === "" ? "" : <>{description}{"\\n\\n"}</>}{children}</blockquote>;
23
+ export const Accordion = ({ title = "", description = "", children }) => <blockquote>{"${BLOCK_MARKERS.Accordion}"}{title === "" ? "" : " " + title}{"\\n\\n"}{description === "" ? "" : <>{description}{"\\n\\n"}</>}{children}</blockquote>;
19
24
 
20
25
  export const ParamField = ({ path = "", body = "", query = "", header = "", type = "", required = false, deprecated = false, default: defaultValue = "", children }) => (path || body || query || header) === "" ? <>{children}</> : <>{"**" + (path || body || query || header) + "**"}{type === "" ? "" : " \\\`" + type + "\\\`"}{required ? " *required*" : ""}{deprecated ? " *deprecated*" : ""}{defaultValue === "" ? "" : " (default: " + defaultValue + ")"}{"\\n\\n"}{children}</>;
21
26
 
22
27
  export const ResponseField = ({ name = "", type = "", required = false, deprecated = false, default: defaultValue = "", children }) => name === "" ? <>{children}</> : <>{"**" + name + "**"}{type === "" ? "" : " \\\`" + type + "\\\`"}{required ? " *required*" : ""}{deprecated ? " *deprecated*" : ""}{defaultValue === "" ? "" : " (default: " + defaultValue + ")"}{"\\n\\n"}{children}</>;
23
28
 
29
+ export const Tab = ({ title = "", children }) => <blockquote>{"${BLOCK_MARKERS.Tab}"}{title === "" ? "" : " " + title}{"\\n\\n"}{children}</blockquote>;
30
+
24
31
  export const Steps = ({ children }) => <>{children}</>;
25
32
 
26
33
  export const Step = ({ title = "", stepNumber = 1, titleSize = "p", children }) => <>{"\\n\\n"}{titleSize === "h2" ? "## " : titleSize === "h3" ? "### " : titleSize === "h4" ? "#### " : "**"}{title === "" ? "Step " + stepNumber : stepNumber + ". " + title}{titleSize === "h2" || titleSize === "h3" || titleSize === "h4" ? "" : "**"}{"\\n\\n"}{children}{"\\n\\n"}</>;
@@ -1,5 +1,5 @@
1
1
  import { getAST, stringifyTree } from '../../remark-core.js';
2
- import { BLOCK_LINK_LABEL } from './firstPartyMarkdownComponents.js';
2
+ import { BLOCK_LINK_LABEL, BLOCK_MARKERS } from './firstPartyMarkdownComponents.js';
3
3
  import { evaluateStatic } from './staticEvaluator.js';
4
4
  import { chargeUnfoldBudget, chargeUnfoldCall, collectMarkdownComponentContext, collectUsageProps, containsJsx, createUnfoldBudget, definitionGatesContent, DROP_ELEMENTS, FORM_CONTROL_ELEMENTS, dropPairedDarkOnly, escapeInterpolatedText, HEADING_ELEMENTS, isPresentationalAttribute, UNWRAP_BLOCK_ELEMENTS, UNWRAP_INLINE_ELEMENTS, escapeLinkLabel, extractProgramExpression, FAILED_SPREAD, markdownLinkDestination, MAX_UNFOLD_DEPTH, GFM_ALERT_PATTERN, HEADLINE_ATTRIBUTES, KEEP_TAG_COMPONENTS, materializeComponent, serializeExpressionJsx, } from './unfoldComponentsForMarkdown.js';
5
5
  import { toVisibilityGroups, toVisibilityGroupsRule, } from './visibility-auth-rule.js';
@@ -859,6 +859,14 @@ function replaceChildren(children, next) {
859
859
  children.length = 0;
860
860
  children.push(...next);
861
861
  }
862
+ function findBlockMarker(value) {
863
+ return Object.values(BLOCK_MARKERS).find((marker) => {
864
+ if (!value.startsWith(marker))
865
+ return false;
866
+ const next = value.charAt(marker.length);
867
+ return next === '' || next === ' ' || next === '\n';
868
+ });
869
+ }
862
870
  function normalizeGfmAlerts(nodes) {
863
871
  for (const node of nodes) {
864
872
  if (node.type === 'blockquote') {
@@ -879,6 +887,13 @@ function normalizeGfmAlerts(nodes) {
879
887
  }
880
888
  node.children.unshift({ type: 'html', value: match[0] });
881
889
  }
890
+ else {
891
+ const marker = findBlockMarker(firstChild.value);
892
+ if (marker !== undefined) {
893
+ const remainder = firstChild.value.slice(marker.length);
894
+ first.children.splice(0, 1, { type: 'html', value: marker }, ...(remainder === '' ? [] : [Object.assign(Object.assign({}, firstChild), { value: remainder })]));
895
+ }
896
+ }
882
897
  }
883
898
  }
884
899
  }