@redocly/redoc-reef 0.140.0-next.4 → 0.140.0-next.5
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.
- package/CHANGELOG.md +27 -0
- package/dist/cli/generate/get-schema-template.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdocRenderer.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +1 -33
- package/dist/markdoc/attributes/definition-path.d.ts +1 -1
- package/dist/markdoc/attributes/json-example-ref.d.ts +1 -1
- package/dist/markdoc/attributes/json-schema-ref.d.ts +1 -1
- package/dist/markdoc/attributes/parsed-yaml.d.ts +1 -1
- package/dist/markdoc/attributes/raw-content.d.ts +1 -1
- package/dist/markdoc/attributes/sample-from-json-schema.d.ts +1 -1
- package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +1 -1
- package/dist/markdoc/helpers/get-inner-text.d.ts +1 -1
- package/dist/markdoc/helpers/get-node-attribute.d.ts +1 -1
- package/dist/markdoc/helpers/get-variable.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-conditional-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-function.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-tag.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-variable.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.js +1 -1
- package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
- package/dist/markdoc/helpers/set-node-attribute-value.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.js +1 -1
- package/dist/markdoc/nodes/gfm-list-item.d.ts +1 -1
- package/dist/markdoc/nodes/gfm-list-item.js +1 -1
- package/dist/markdoc/nodes/heading.d.ts +1 -1
- package/dist/markdoc/nodes/heading.js +1 -1
- package/dist/markdoc/nodes/index.d.ts +6 -165
- package/dist/markdoc/nodes/index.js +1 -1
- package/dist/markdoc/nodes/table.d.ts +1 -1
- package/dist/markdoc/nodes/table.js +1 -1
- package/dist/markdoc/nodes/text.d.ts +1 -1
- package/dist/markdoc/tags/json-example.js +1 -1
- package/dist/server/esbuild/plugins/dependency-resolver.js +1 -1
- package/dist/server/plugins/api-docs/loader.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/index.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-diagram-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-gallery.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/errors.d.ts +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -1
- package/dist/server/plugins/markdown/markdoc/functions/concat.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +5 -165
- package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
- package/dist/server/plugins/markdown/markdoc/partials.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/headings.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -1
- package/dist/server/plugins/markdown/runtime-transform.d.ts +2 -2
- package/dist/server/plugins/markdown/runtime-transform.js +1 -1
- package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
- package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +1 -1
- package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
- package/dist/server/plugins/markdown/search/to-markdown.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.d.ts +1 -1
- package/dist/server/store.d.ts +1 -1
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +1 -1
- package/dist/server/utils/codeframes/codeframes.d.ts +1 -1
- package/dist/server/utils/codeframes/yaml-ast.d.ts +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/markdoc.d.ts +1 -1
- package/package.json +6 -6
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.d.ts +0 -6
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +0 -1
- package/dist/server/plugins/markdown/html/process-html-tokens.d.ts +0 -2
- package/dist/server/plugins/markdown/html/process-html-tokens.js +0 -1
- package/dist/server/plugins/markdown/source.d.ts +0 -4
- package/dist/server/plugins/markdown/source.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveLink(node: WithOriginalAttr<Node>, attributeName: string, fromPage: string, { actions, context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves native Markdown links/images (e.g., `[]()` or `![]()`) using `resolveLink` and then applies the global
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
2
|
-
import type { Node } from '@
|
|
2
|
+
import type { Node } from '@redocly/markdoc';
|
|
3
3
|
export declare function resolveNavLinks(node: WithOriginalAttr<Node, any>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-nav-links.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveOpenApiRef(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiCodeSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-code-samples.d.ts.map
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiResponseSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-response-samples.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveParsedYaml(node: Node, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-parsed-yaml.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveRawContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-raw-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativeOrCdnIcon(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-or-cdn-icon.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativePath(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, context: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-path.d.ts.map
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSampleFromJsonSchema(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-sample-from-json-schema.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSvgContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-svg-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveTagRawContent(node: Node, attrName: string, _relativePath: string, { readSourceLines }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-tag-raw-content.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();
|
|
1
|
+
import s from"@redocly/markdoc";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";async function k(t,i,e,{readSourceLines:n}){if(t.children.length===0&&typeof t.attributes[i]=="string")return;if(t.inline){c(t,i,p(t)),t.children=[];return}if(n===void 0)return;const r=t.location?.start.line,f=t.location?.end.line;if(r===void 0||f===void 0)return;const l=n(),o=g(l.slice(r,f),t.tag);if(o===void 0)return;const u=x(l[r]??""),d=l.slice(r+o.start,r+o.end).map(h=>w(h,u)),a=y(d).join(`
|
|
2
|
+
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();c(t,i,a),t.children=[]}function g(t,i){const e=m(t);if(e===void 0||i===void 0)return;const n=new RegExp(`\\{%\\s*/${i}(?![\\w-])`);let r=t.length-1;for(;r>e&&!n.test(t[r]??"");)r-=1;return r>e?{start:e+1,end:r}:void 0}function m(t){let i=!1;for(let e=0;e<t.length;e+=1){const n=t[e]??"";for(let r=e===0?n.indexOf("{%")+2:0;r<n.length;r+=1)if(i)n[r]==="\\"?r+=1:n[r]==='"'&&(i=!1);else if(n[r]==='"')i=!0;else if(n[r]==="%"&&n[r+1]==="}")return e}}function p(t){return s.format(new s.Ast.Node("inline",{},t.children)).trim()}function x(t){return t.slice(0,Math.max(t.indexOf("{%"),0)).split(">").length-1}function w(t,i){let e=t;for(let n=0;n<i;n+=1){const r=e.match(/^ {0,3}> ?/);if(!r)break;e=e.slice(r[0].length)}return e}function y(t){const i=t.filter(n=>n.trim()!=="").map(n=>n.match(/^[ \t]*/)?.[0]??""),e=i.reduce(E,i[0]??"");return t.map(n=>n.startsWith(e)?n.slice(e.length):n.trimStart())}function E(t,i){let e=0;for(;e<t.length&&e<i.length&&t[e]===i[e];)e+=1;return t.slice(0,e)}export{k as resolveTagRawContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node, Tag } from '@
|
|
1
|
+
import type { Node, Tag } from '@redocly/markdoc';
|
|
2
2
|
export declare function getLinkOriginalAttrName(attributeName: string): `redocly:::linkOriginal:${string}`;
|
|
3
3
|
export declare function getOptionalAttribute<T>(node: Node | Tag, attrName: string): T | undefined;
|
|
4
4
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, Node, ValidationType } from '@
|
|
1
|
+
import type { Config, Node, ValidationType } from '@redocly/markdoc';
|
|
2
2
|
import type { Store } from '../../store.js';
|
|
3
3
|
import type { LifecycleContext, MarkdownParseInput, MarkdocResolveContext } from '../../types';
|
|
4
4
|
import type { MarkdocError } from '../../../types/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import N from"@redocly/markdoc";import{htmlTags as B}from"@redocly/markdoc/html";import*as M from"path";import{convertGithubAlertToAdmonition as H}from"@redocly/theme/markdoc/tags/admonition";import{GATED_MARKDOC_TAGS as F}from"../../constants/entitlements.js";import{logger as G}from"../../tools/notifiers/logger.js";import{reporter as K}from"../../tools/notifiers/reporter.js";import{sha1 as V}from"../../utils/crypto/sha1.js";import{formatMarkdocError as U}from"./errors.js";import{extractFirstHeading as q,SKIP as j,visit as $}from"./markdoc/plugins/utils.js";import{isPromptNode as z}from"../../../markdoc/helpers/guards/is-prompt-node.js";import{attributeResolvers as E}from"./attribute-resolvers/index.js";import{MdResolveError as J}from"./attribute-resolvers/md-resolve-error.js";import{normalizeHtmlHeadings as Q}from"./html/normalize-html-headings.js";import{resolveRawPartials as X}from"./markdoc/resolve-raw-partials.js";import{exampleContentTrees as Z,reparseExampleFences as tt}from"./markdoc/reparse-example-fences.js";import{EntitlementsProvider as at}from"../../entitlements/entitlements-provider.js";import{MARKDOC_PARTIALS_DEPS_KEY as rt}from"../../constants/common.js";import{getLinkOriginalAttrName as et}from"./attribute-resolvers/utils.js";import{createSourceLinesReader as ot}from"./create-source-lines-reader.js";const it="EMPTY";async function st(a,r,e){const f=at.instance(),{actions:n}=e,{relativePath:c,resolveErrors:S}=a,w={...e,readSourceLines:ot(a.rawContent)},g=new Set,u=new Set,l=new Set,b=new Set,s={},D=new Set,L={},_={};function P(t,o){const k=o||it;t[k]=(t[k]||0)+1}const T=[];a.resolveErrors.length=0;const A=Z(a.ast),I=t=>{H(t);const o=k();T.push(o.then(y=>{y?.sharedDataIds&&y.sharedDataIds.forEach(d=>g.add(d))}).catch(Y(t)));async function k(){const y=[];switch(t.type){case"fence":P(L,t.attributes.language);break;case"link":case"image":await E.nativeMdLink(t,t.type==="link"?"href":"src",c,w);break;case"tag":{if(!t.tag)break;const d=r?.tags?.[t.tag];if(!d){F[t.tag]&&!f.canAccessFeature(F[t.tag])&&(t.addError({level:"warning",id:"invalid-tag",message:`Undefined tag: ${t.tag}`}),t.tag="",t.type="error",t.attributes={});break}const v=t.tag==="html"?t.attributes.name:t.tag;if((t.tag==="html"?D:b).add(v),s[v]=(s[v]||0)+1,v==="code-snippet"&&P(L,t.attributes.language),d.attributes?.__idx&&(t.attributes.__idx=s[t.tag]),d.dynamicComponentLib&&u.add(d.dynamicComponentLib),!d.attributes)break;if(v==="partial"&&t.attributes?.file){const i=et("file"),m=t[i]||t.attributes.file,h=m.startsWith("/")?m.slice(1):M.posix.normalize(M.posix.join(M.posix.dirname(c),m));l.add(h);const p=(n.getGlobalConfig(rt)||{})[h];if(p?.dynamicComponents)for(const R of p.dynamicComponents)u.add(R);if(p?.sharedDataDeps)for(const R of p.sharedDataDeps)g.add(R)}for(const[i,m]of Object.entries(d.attributes)){const h=m.type;if(h&&(h.resolver||m.resolver)){const x=E[h.resolver||m.resolver],p=await x?.(t,i,c,w);p?.sharedDataId&&y.push(p.sharedDataId)}}if(v==="code-walkthrough")for(const i of t.attributes.resolvedFilesets||[])for(const m of i.files||[])P(_,m.language);const O=t.attributes?.attrs;if(O&&t.tag==="html")for(const i of Object.keys(O))i==="src"||i==="srcSet"?await E.htmlSourceAttribute(t,i,c,w):i==="href"&&await E.htmlHref(t,i,c,w);break}}return{sharedDataIds:y}}};function Y(t){return async o=>{if(!(o instanceof J)){await K.panicOnBuild(o.message);return}S.push(U({type:"resolve_link",meta:{...o.meta,link:o.meta.link??o.meta.rawLink},lines:t.location?[t.location.start.line,t.location.end.line]:[],location:t.location,error:{id:"",level:"error",message:o.message,location:t.location}},a.relativePath,a.rawContent))}}$(a.ast,t=>(I(t),z(t)?j:void 0));for(const t of A)$(t,o=>(H(o),o.type==="tag"&&I(o),z(o)?j:void 0));return await Promise.all(T),a.sharedDataDeps=g,a.dynamicMarkdocComponents=u,a.validatedAtRevision<n.buildRevision&&(a.markdocErrors=[a.ast,...A].flatMap(t=>N.validate(t,r)).map(t=>U(t,c,a.rawContent)),a.validatedAtRevision=n.buildRevision),{sharedDataDeps:a.sharedDataDeps,dynamicMarkdocComponents:Array.from(a.dynamicMarkdocComponents?.values()??[]),partials:Array.from(l),tagList:Array.from(b),htmlTagsList:Array.from(D),tagOccurrence:s,codeSnippetLanguages:L,codeWalkthroughLanguages:_}}const C="unclosed-html",nt={html:B({errorTag:C}),allowIndentation:!0,allowComments:!0};function W(a,r){const e=N.parse(a,{...nt,...r});return ct(e),Q(e),e}function ct(a){for(const r of a.walk())r.type!=="tag"||r.tag!==C||(r.type="error",r.errors.push({id:"parse-error",level:"critical",message:String(r.attributes.message),location:r.location}))}function lt(a,r){const e=W(r,{file:a,slots:!0});return tt(e,n=>W(n,{file:a})),{ast:e,rawContent:r,resolveErrors:[],markdocErrors:[],relativePath:a,sharedDataDeps:void 0,validatedAtRevision:-1}}async function Tt(a,r){const{data:e}=await r.cache.load(a,"markdown-ast");return q(e.ast)}async function At(a,r){K.clearMarkdocProblems();const e=a.getAllRoutes();let f=0;const n=G.isInteractive();for(const c of e)await a.resolveRouteStaticData(c,r,!0),f++,n&&f%100===0&&G.logInFooter("validate",` \u{1F50D} Status: validating markdoc (${f}/${e.length})`)}async function It(a,r,e,f){const n=a.content?V(a.content):"";return await e.context.cache.load(f||a.relativePath,{loader:S,name:"markdown-inline-parser"},[n,String(e.actions.buildRevision)]);async function S(w,g,u){let l;if(a.content){const s=await g.getConfig(),D=await X(a.content,a.relativePath,s.markdown?.partialsFolders,g);l=lt(a.relativePath,D)}else l=(await g.cache.load(a.relativePath,"markdown-ast")).data;let b={};if(e.actions.buildRevision!==0&&(b=await st(l,r,e)),!a.isVirtual){for(const s of l.markdocErrors)u(s);for(const s of l.resolveErrors)u(s)}return{ast:l.ast,info:b}}}export{Tt as extractMdFirstHeading,lt as getAst,It as parseAndResolveMarkdoc,st as resolveAndValidateMarkdoc,At as validateAllMarkdowns};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NormalizedProblem } from '@redocly/openapi-core';
|
|
2
|
-
import type { ValidateError, LocationEdge } from '@
|
|
2
|
+
import type { ValidateError, LocationEdge } from '@redocly/markdoc';
|
|
3
3
|
import type { MarkdocError, BrokenLinkType } from '../../../types/index.js';
|
|
4
4
|
export type ValidateErrorWithMeta = ValidateError & {
|
|
5
5
|
meta?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@
|
|
1
|
+
import e from"@redocly/markdoc";import{getPublicEnvVariables as u}from"../../utils/envs/get-public-env-variables.js";import{transformMdAst as i}from"./runtime-transform";const v=async(A,o,t,s)=>{const{ast:l,frontmatter:r,props:n,editPage:f,lastModified:m,isTranslationFallback:b}=o,{headings:d,renderableAst:p}=await i(e.Ast.fromJSON(l),{partials:t.partials,variables:{frontmatter:r,...t.variables,env:u()}},s.serverOutDir);return Array.isArray(r.banner)&&(r.banner=await Promise.all(r.banner.map(async a=>{if(a.ast){const{renderableAst:c}=await i(e.Ast.fromJSON(a.ast),{partials:{},variables:{}},s.serverOutDir);return{...a,ast:c}}return a}))),{...n,ast:p,headings:d,frontmatter:r,editPage:f,lastModified:m,...b?{isTranslationFallback:!0}:{}}};var k=v;export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
/**
|
|
3
3
|
* Rewrites block-level raw HTML `<h1>`…`<h6>` elements into Markdoc `heading` nodes,
|
|
4
4
|
* so they get an anchor id, a TOC entry and a search section like Markdown headings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l from"@redocly/markdoc";const s=/^h([1-6])$/;function u(t){r(t,!1)}function r(t,i){const n=i||t.type==="inline";t.children=t.children.map(e=>{const o=(n?void 0:a(e))??e;return r(o,n),o});for(const e of Object.values(t.slots))r(e,n)}function a(t){if(t.type!=="tag"||t.tag!=="html")return;const i=s.exec(t.attributes.name)?.[1];if(!i)return;const n=t.attributes.attrs?.id,e=new l.Ast.Node("heading",{level:Number(i),...typeof n=="string"&&{id:n}},[new l.Ast.Node("inline",{},t.children)]);return e.location=t.location,e}export{u as normalizeHtmlHeadings};
|
|
@@ -7,171 +7,11 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
|
|
|
7
7
|
td: import("@markdoc/markdoc").Schema;
|
|
8
8
|
th: import("@markdoc/markdoc").Schema;
|
|
9
9
|
text: import("@markdoc/markdoc").Schema;
|
|
10
|
-
strong:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
inline?: boolean;
|
|
16
|
-
transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
17
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
|
|
18
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
19
|
-
variables: Record<string, any>;
|
|
20
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
21
|
-
partials: Record<string, any>;
|
|
22
|
-
validation?: {
|
|
23
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
24
|
-
validateFunctions?: boolean;
|
|
25
|
-
environment?: string;
|
|
26
|
-
};
|
|
27
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
|
|
28
|
-
validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
29
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
30
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
31
|
-
variables: Record<string, any>;
|
|
32
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
33
|
-
partials: Record<string, any>;
|
|
34
|
-
validation?: {
|
|
35
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
36
|
-
validateFunctions?: boolean;
|
|
37
|
-
environment?: string;
|
|
38
|
-
};
|
|
39
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
|
|
40
|
-
description?: string;
|
|
41
|
-
children: string[];
|
|
42
|
-
};
|
|
43
|
-
em: {
|
|
44
|
-
render?: string | undefined;
|
|
45
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute>;
|
|
46
|
-
slots?: Record<string, import("@markdoc/markdoc").SchemaSlot>;
|
|
47
|
-
selfClosing?: boolean;
|
|
48
|
-
inline?: boolean;
|
|
49
|
-
transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
50
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
51
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
52
|
-
variables: Record<string, any>;
|
|
53
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
54
|
-
partials: Record<string, any>;
|
|
55
|
-
validation?: {
|
|
56
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
57
|
-
validateFunctions?: boolean;
|
|
58
|
-
environment?: string;
|
|
59
|
-
};
|
|
60
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
|
|
61
|
-
validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
62
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
63
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
64
|
-
variables: Record<string, any>;
|
|
65
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
66
|
-
partials: Record<string, any>;
|
|
67
|
-
validation?: {
|
|
68
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
69
|
-
validateFunctions?: boolean;
|
|
70
|
-
environment?: string;
|
|
71
|
-
};
|
|
72
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
|
|
73
|
-
description?: string;
|
|
74
|
-
children: string[];
|
|
75
|
-
};
|
|
76
|
-
s: {
|
|
77
|
-
render?: string | undefined;
|
|
78
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute>;
|
|
79
|
-
slots?: Record<string, import("@markdoc/markdoc").SchemaSlot>;
|
|
80
|
-
selfClosing?: boolean;
|
|
81
|
-
inline?: boolean;
|
|
82
|
-
transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
83
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
84
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
85
|
-
variables: Record<string, any>;
|
|
86
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
87
|
-
partials: Record<string, any>;
|
|
88
|
-
validation?: {
|
|
89
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
90
|
-
validateFunctions?: boolean;
|
|
91
|
-
environment?: string;
|
|
92
|
-
};
|
|
93
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
|
|
94
|
-
validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
95
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
96
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
97
|
-
variables: Record<string, any>;
|
|
98
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
99
|
-
partials: Record<string, any>;
|
|
100
|
-
validation?: {
|
|
101
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
102
|
-
validateFunctions?: boolean;
|
|
103
|
-
environment?: string;
|
|
104
|
-
};
|
|
105
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
|
|
106
|
-
description?: string;
|
|
107
|
-
children: string[];
|
|
108
|
-
};
|
|
109
|
-
link: {
|
|
110
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute>;
|
|
111
|
-
slots?: Record<string, import("@markdoc/markdoc").SchemaSlot>;
|
|
112
|
-
selfClosing?: boolean;
|
|
113
|
-
inline?: boolean;
|
|
114
|
-
transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
115
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
116
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
117
|
-
variables: Record<string, any>;
|
|
118
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
119
|
-
partials: Record<string, any>;
|
|
120
|
-
validation?: {
|
|
121
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
122
|
-
validateFunctions?: boolean;
|
|
123
|
-
environment?: string;
|
|
124
|
-
};
|
|
125
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
|
|
126
|
-
validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
127
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
128
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
129
|
-
variables: Record<string, any>;
|
|
130
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
131
|
-
partials: Record<string, any>;
|
|
132
|
-
validation?: {
|
|
133
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
134
|
-
validateFunctions?: boolean;
|
|
135
|
-
environment?: string;
|
|
136
|
-
};
|
|
137
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
|
|
138
|
-
description?: string;
|
|
139
|
-
render: string;
|
|
140
|
-
children: string[];
|
|
141
|
-
};
|
|
142
|
-
document: {
|
|
143
|
-
render?: string | undefined;
|
|
144
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute>;
|
|
145
|
-
slots?: Record<string, import("@markdoc/markdoc").SchemaSlot>;
|
|
146
|
-
selfClosing?: boolean;
|
|
147
|
-
inline?: boolean;
|
|
148
|
-
transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
149
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
150
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
151
|
-
variables: Record<string, any>;
|
|
152
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
153
|
-
partials: Record<string, any>;
|
|
154
|
-
validation?: {
|
|
155
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
156
|
-
validateFunctions?: boolean;
|
|
157
|
-
environment?: string;
|
|
158
|
-
};
|
|
159
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
|
|
160
|
-
validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
|
|
161
|
-
nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
|
|
162
|
-
tags: Record<string, import("@markdoc/markdoc").Schema>;
|
|
163
|
-
variables: Record<string, any>;
|
|
164
|
-
functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
|
|
165
|
-
partials: Record<string, any>;
|
|
166
|
-
validation?: {
|
|
167
|
-
parents?: import("@markdoc/markdoc").Node[];
|
|
168
|
-
validateFunctions?: boolean;
|
|
169
|
-
environment?: string;
|
|
170
|
-
};
|
|
171
|
-
}>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
|
|
172
|
-
description?: string;
|
|
173
|
-
children: string[];
|
|
174
|
-
};
|
|
10
|
+
strong: import("@markdoc/markdoc").Schema;
|
|
11
|
+
em: import("@markdoc/markdoc").Schema;
|
|
12
|
+
s: import("@markdoc/markdoc").Schema;
|
|
13
|
+
link: import("@markdoc/markdoc").Schema;
|
|
14
|
+
document: import("@markdoc/markdoc").Schema;
|
|
175
15
|
};
|
|
176
16
|
tags: {
|
|
177
17
|
schemaDefinition: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"@
|
|
1
|
+
import f from"@redocly/markdoc";import*as p from"@redocly/theme/markdoc/default";import{reporter as g}from"../../../tools/notifiers/reporter.js";import*as u from"../../../../markdoc/nodes/index.js";import d from"../../../../markdoc/tags/index.js";import{normalizeCustomTags as l}from"../../../../markdoc/helpers/normalize-custom-tags.js";import{includes as h}from"./functions/includes.js";import{importUserTags as O}from"./import-user-tags.js";import{concat as y}from"./functions/concat.js";const T=p.tags;function b(s){const{tags:c,functions:e={},...r}=s,n={...c,...r},a=Object.entries(n),o=[],t=[];for(const[i,m]of a)i in f.nodes?o.push([i,m]):t.push([i,m]);return{nodes:Object.fromEntries(o),tags:Object.fromEntries(t),functions:e}}async function _(s="../../../esbuild/cache/server/",c=""){let e;try{e=(await O(s)).schema}catch(t){throw t.code==="ERR_MODULE_NOT_FOUND"?(g.printErrors(),new Error("Please fix the errors above and try again.")):t}const{tags:r={},nodes:n={},functions:a={}}=b(e),o={tags:{schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean}}}}};return{nodes:{...u,...n},tags:{...d,...T,...l(r),...o.tags},functions:{...f.functions,...a,includes:h,concat:y}}}export{_ as getMarkdocOptions};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { LifecycleContext, AfterRoutesCreatedActions } from '../../../types';
|
|
3
3
|
export declare function prepareMarkdocPartials(context: LifecycleContext, actions: AfterRoutesCreatedActions): Promise<Record<string, Node>>;
|
|
4
4
|
//# sourceMappingURL=partials.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
type ParseMarkdownFn = (content: string) => Node;
|
|
3
3
|
/** Parse each `{% markdoc-example %}` fence body onto the fence, out of the page tree. */
|
|
4
4
|
export declare function reparseExampleFences(ast: Node, parseMarkdown: ParseMarkdownFn): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EXAMPLE_CONTENT_ATTRIBUTE as
|
|
1
|
+
import{EXAMPLE_CONTENT_ATTRIBUTE as c}from"@redocly/theme/core/constants";import{isExampleNode as l}from"../../../../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as a}from"../../../../markdoc/helpers/guards/is-fence-node.js";const u="no-inline-annotations";function d(o,t){for(const e of s(o)){if(!e.children.length)continue;const{content:n}=e.attributes;if(typeof n!="string")continue;const i=t(n),f=(e.location?.start.line??0)+1;for(const r of i.children)m(r,f);e.children=[],e.slots={},e.errors=e.errors.filter(r=>r.id!==u),e.attributes[c]=i,d(i,t)}}function p(o){const t=[];for(const e of s(o)){const n=e.attributes[c];n&&t.push(n,...p(n))}return t}function*s(o){for(const t of o.walk()){if(!l(t))continue;const[e]=t.children;a(e)&&(yield e)}}function m(o,t){for(const e of[o,...o.walk()]){const{location:n}=e;n&&(typeof n.start?.line=="number"&&(n.start.line+=t),typeof n.end?.line=="number"&&(n.end.line+=t))}}export{p as exampleContentTrees,d as reparseExampleFences};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MdOptions } from '@redocly/config';
|
|
3
3
|
export declare function transformMdAst(ast: Node, config: MdOptions, serverOutDir: string): Promise<{
|
|
4
4
|
headings: {
|
|
@@ -6,7 +6,7 @@ export declare function transformMdAst(ast: Node, config: MdOptions, serverOutDi
|
|
|
6
6
|
id: string;
|
|
7
7
|
depth: number;
|
|
8
8
|
}[];
|
|
9
|
-
renderableAst: import("@markdoc/markdoc").
|
|
9
|
+
renderableAst: import("@markdoc/markdoc").RenderableTreeNodes;
|
|
10
10
|
pageProps: any;
|
|
11
11
|
}>;
|
|
12
12
|
//# sourceMappingURL=runtime-transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"@
|
|
1
|
+
import c from"@redocly/markdoc";import{isTag as b}from"../../../markdoc/helpers/guards/is-tag.js";import{slugger as f}from"../../utils/index.js";import{getMarkdocOptions as l}from"./markdoc/markdoc-options.js";import{visit as h,getHeadingData as k,getNumberedItemHeadingData as D}from"./markdoc/plugins/utils.js";import{renderDiagramsWithVariants as H}from"./markdoc/plugins/render-diagrams.js";import{deepStringify as v}from"./markdoc/utils/deep-stringify.js";import{stringifyTagChildrenObjects as y}from"./utils/stringify-tag-children-objects.js";async function S(d,e,p){const g=await l(p),i=[],a=[],o=v(e.variables?.pageProps),{headers:T,...u}=e.variables||{};f.reset();const m=c.transform(d,{...g,...e,variables:{...u,pageProps:o}});let n=0;h(m,r=>{if(b(r)){switch(r.name){case"Heading":{r.attributes.__idx=n,n++;const t=k(r);t&&i.push(t);break}case"NumberedItem":{const t=D(r);t&&i.push(t);break}case"Diagram":a.push({tag:r,input:{type:r.attributes.diagramType,source:r.attributes.diagramSource}});break}y(r)}});const s=await H(a.map(r=>r.input));for(let r=0;r<a.length;r++)a[r].tag.attributes.diagramError=s[r].error,a[r].tag.attributes.diagramHtml=s[r].light,a[r].tag.attributes.diagramHtmlDark=s[r].dark;return{headings:i,renderableAst:m,pageProps:o}}export{S as transformMdAst};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import M from"@
|
|
1
|
+
import M from"@redocly/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as R,AI_SEARCH_DOCUMENT_CHUNK_SIZE as v}from"../../../constants/plugins/search.js";import{slugger as I}from"../../../../utils/slugger.js";import{joinSectionContent as N}from"./join-section-content.js";import{toMarkdown as P}from"./to-markdown.js";import{AstToSearchNodeTransformer as w}from"./walk-sections.js";import{createRenderTagFn as x}from"./create-render-tag-fn.js";import{getBuildTranslateContext as K}from"../../../utils/l10n/get-build-translate-context.js";import{getLocaleFromRelativePath as L}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as b}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as U}from"./search-facets.js";import{formatDocumentMetadata as y}from"../../search/utils.js";import{TagNode as H}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as O}from"../../../constants/common.js";const j=Symbol(),at=(n,o)=>async(e,r,i,c)=>{if(o?.excludeFromSearch)return;I.reset();const l=await e.getNavText?.()||D.basename(e.fsPath),f=M.Ast.fromJSON(r.ast),{locale:g,translate:A}=await K(e.slug,c.getGlobalData?.().l10n),s=new w({partials:c.getGlobalConfig(O)||{},renderTag:x(c.markdocOptions.tags,g,A),getInnerContent:P,ast:f,skipConditionals:!0}),d=Array.from(s.transform());return{async getLLMsTxts(){const u=o?.seo,t=u&&typeof u=="object"&&"description"in u?String(u.description):void 0,a=N(d);return[{title:l,description:t,slug:e.slug,fsPath:e.fsPath,content:a,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,d,n,l)}}};function F(n,o,e,r){const i=n.slug,c=new Map,l=n.metadata||{},f=U(l,e),g=y(l),A=g?`Metadata:
|
|
2
2
|
${g}
|
|
3
3
|
`:"",s=[];for(const t of o)if(t instanceof b){s.splice(t.attributes.level-1,6);const a=t.attributes.level>2,m=s[s.length-1]?.title,T=s[s.length-1]?.url,C=a&&m?m:W(r,t),S=a&&T?T:t.getUrl(i),p={title:C,content:"",url:S,level:t.attributes.level,toc:s.map(E=>h(E.section)).join(`
|
|
4
4
|
`)};(t.attributes.level>1||h(t)!==r)&&(p.content+=p.content?`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import d from"@
|
|
1
|
+
import d from"@redocly/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as T}from"../../../../markdoc/helpers/get-inner-text.js";import{skipAgentsOnlyContent as h}from"@redocly/theme/markdoc/tags/visibility";import{getSearchDocuments as g}from"./get-search-documents.js";import{AstToSearchNodeTransformer as C}from"./walk-sections.js";import{setDocumentSearchFacets as R,extractDocumentSearchFacets as S}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../constants/common.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function Y(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=d.Ast.fromJSON(r.ast),f=new C({ast:i,getInnerContent:T,partials:a.getGlobalConfig(D)||{},renderTag:h,indexPromptTitles:!0}),p=t.metadata||{},n=S(p,o);R(n,o,c);const u=e?.seo?.title||m,{result:s}=_(e?.keywords);return g(f,t.slug,u,r[A],r[l],n,s||void 0)}}export{Y as searchResolver};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Function, Node, RenderableTreeNode, Variable } from '@
|
|
1
|
+
import type { Function, Node, RenderableTreeNode, Variable } from '@redocly/markdoc';
|
|
2
2
|
import type { GetInnerContentFnOptions } from '../../../../types/index.js';
|
|
3
3
|
export declare function toMarkdown(children: (RenderableTreeNode | Node | Variable | Function)[], options?: GetInnerContentFnOptions): string;
|
|
4
4
|
//# sourceMappingURL=to-markdown.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { GetInnerContentFn } from '../../../../types/index.js';
|
|
3
3
|
import type { SearchNode } from './nodes/types.js';
|
|
4
4
|
import type { RenderTagFn } from '../../../types/plugins/markdown.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{PROMPT_TAG as a}from"@redocly/theme/core/constants";import{logger as w}from"../../../tools/notifiers/logger.js";import{isNode as p}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as b}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as g,TagNode as u}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class G{#r;#e;#o;#s;#c;#n;constructor({ast:i,partials:t,skipConditionals:s=!1,getInnerContent:r,renderTag:e,indexPromptTitles:o=!1}){if(this.#r=i,this.#e=t,this.#o=s,this.#s=r,this.#c=e,this.#n=o,!this.#r||!p(this.#r))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#o,renderTag:this.#c,...i}}*transform(){yield*this.#l(this.#r,{parentNode:null})}*#l(i,t,s=this.#s){if(!(!i||!p(i))){if(N(i)){if(this.#o)return;const r=b(i);r&&r.length>0&&(yield*this.#t(i,{...t,rbacTeams:r},s));return}if(m(i)){yield new n({node:i,content:s([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:s([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#h(i,t,s);return}yield*this.#t(i,t,s)}}*#h(i,t,s=this.#s){switch(i.tag){case"partial":{const r=i.attributes.file,e=i.attributes.variables??{};if(r&&this.#e[r]){yield*this.#l(this.#e[r],t,(o,h)=>s(o,{...h,variables:e}));return}w.warn(`Could not create search indexes for partial \u201C${r}\u201D: file not found`);return}case"html":case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,s);return}case a:{const r=f(i,"title");this.#n&&r&&(yield new u({node:i,content:r,...t}));return}case"markdoc-example":{const r=s([i],this.#i());yield new n({node:i,content:r,...t});return}case"code-snippet":{const r=f(i,"title"),e=s([i],this.#i());if(r){const o=new u({node:i,content:r,...t});t={...t,parentNode:o},yield o}e&&(yield new n({node:i,content:e,...t}));return}default:{const r=this.#f(i,t,s);if(r!==void 0){yield new n({node:i,content:k(r),...t});return}const e=g.find(l=>l in i.attributes),o=(e&&f(i,e))??"",h=typeof o=="string"?o:s([o]);if(h){const l=new u({node:i,content:h,...t});t={...t,parentNode:l},yield l}if(T(i))yield*this.#t(i,t,s);else{const l=s([i],this.#i());l&&(yield new n({node:i,content:l,...t}))}return}}}#f(i,t,s){const r=()=>T(i)?d([...this.#t(i,t,s)]):"";return this.#c?.(i,{getBody:r})}*#t(i,t,s=this.#s){for(const r of[...Object.values(i.slots),...i.children])for(const e of this.#l(r,t,s))e instanceof y&&(t={...t,parentNode:e}),yield e}}function T(c){return c.children.length>0||Object.keys(c.slots).length>0}function k(c){return c.endsWith(`
|
|
1
|
+
import{PROMPT_TAG as a}from"@redocly/theme/core/constants";import{logger as w}from"../../../tools/notifiers/logger.js";import{isNode as p}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as b}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as g,TagNode as u}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class G{#r;#e;#o;#s;#c;#n;constructor({ast:i,partials:t,skipConditionals:s=!1,getInnerContent:r,renderTag:e,indexPromptTitles:o=!1}){if(this.#r=i,this.#e=t,this.#o=s,this.#s=r,this.#c=e,this.#n=o,!this.#r||!p(this.#r))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#o,renderTag:this.#c,...i}}*transform(){yield*this.#l(this.#r,{parentNode:null})}*#l(i,t,s=this.#s){if(!(!i||!p(i))){if(N(i)){if(this.#o)return;const r=b(i);r&&r.length>0&&(yield*this.#t(i,{...t,rbacTeams:r},s));return}if(m(i)){yield new n({node:i,content:s([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:s([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#h(i,t,s);return}yield*this.#t(i,t,s)}}*#h(i,t,s=this.#s){switch(i.tag){case"partial":{const r=i.attributes.file,e=i.attributes.variables??{};if(r&&this.#e[r]){yield*this.#l(this.#e[r],t,(o,h)=>s(o,{...h,variables:e}));return}w.warn(`Could not create search indexes for partial \u201C${r}\u201D: file not found`);return}case"html":case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,s);return}case a:{const r=f(i,"title");this.#n&&r&&(yield new u({node:i,content:r,...t}));return}case"markdoc-example":{const r=s([i],this.#i());yield new n({node:i,content:r,...t});return}case"code-snippet":{const r=f(i,"title"),e=s([i],this.#i());if(r){const o=new u({node:i,content:r,...t});t={...t,parentNode:o},yield o}e&&(yield new n({node:i,content:e,...t}));return}default:{const r=this.#f(i,t,s);if(r!==void 0){yield new n({node:i,content:k(r),...t});return}const e=g.find(l=>l in i.attributes),o=(e&&f(i,e))??"",h=typeof o=="string"?o:s([o]);if(h){const l=new u({node:i,content:h,...t});t={...t,parentNode:l},yield l}if(T(i))yield*this.#t(i,t,s);else{const l=s([i],this.#i());l&&(yield new n({node:i,content:l,...t}))}return}}}#f(i,t,s){const r=()=>T(i)?d([...this.#t(i,t,s)]):"";return this.#c?.(i,{getBody:r})}*#t(i,t,s=this.#s){for(const r of[...Object.values(i.slots??{}),...i.children])for(const e of this.#l(r,t,s))e instanceof y&&(t={...t,parentNode:e}),yield e}}function T(c){return c.children.length>0||Object.keys(c.slots??{}).length>0}function k(c){return c.endsWith(`
|
|
2
2
|
`)?c:`${c}
|
|
3
3
|
`}export{G as AstToSearchNodeTransformer};
|
package/dist/server/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Node } from '@
|
|
1
|
+
import { type Node } from '@redocly/markdoc';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
3
|
import type { CommonError, GlobalData } from '../types/index.js';
|
|
4
4
|
import type { MiddlewareDetails, PageRouteInit, PageRouteDetails, RouteDetails, LifecycleContext, ApiRoute, ParseMarkdocOpts, WildcardRedirectsTree, StaticFilePaths, RedirectOptions, McpToolRegistration, McpToolSchema, MarkdocOptions } from './types';
|