@redocly/realm-plugin-asciidoc 0.1.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.
- package/lib/.tsbuildinfo +1 -0
- package/lib/asciidoc-parser.d.ts +15 -0
- package/lib/asciidoc-parser.js +747 -0
- package/lib/asciidoc-parser.js.map +1 -0
- package/lib/get-ai-search-documents.d.ts +24 -0
- package/lib/get-ai-search-documents.js +133 -0
- package/lib/get-ai-search-documents.js.map +1 -0
- package/lib/plugin.d.ts +2 -0
- package/lib/plugin.js +314 -0
- package/lib/plugin.js.map +1 -0
- package/lib/search-facets.d.ts +3 -0
- package/lib/search-facets.js +34 -0
- package/lib/search-facets.js.map +1 -0
- package/lib/search-resolver.d.ts +4 -0
- package/lib/search-resolver.js +72 -0
- package/lib/search-resolver.js.map +1 -0
- package/lib/template.d.ts +18 -0
- package/lib/template.js +346 -0
- package/lib/template.js.map +1 -0
- package/lib/types.d.ts +130 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +45 -0
- package/src/asciidoc-parser.ts +927 -0
- package/src/get-ai-search-documents.ts +193 -0
- package/src/plugin.ts +483 -0
- package/src/search-facets.ts +46 -0
- package/src/search-resolver.ts +98 -0
- package/src/template.tsx +628 -0
- package/src/types.ts +171 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC } from '@redocly/config';
|
|
11
|
+
import { extractDocumentSearchFacets, setDocumentSearchFacets } from './search-facets.js';
|
|
12
|
+
export function searchResolver(frontmatter, relativePath, sections, getSearchFacets, setSearchFacets) {
|
|
13
|
+
return (route, staticData) => __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
var _a;
|
|
15
|
+
if (frontmatter.excludeFromSearch)
|
|
16
|
+
return [];
|
|
17
|
+
const metadata = route.metadata || {};
|
|
18
|
+
const facets = extractDocumentSearchFacets(metadata, getSearchFacets);
|
|
19
|
+
setDocumentSearchFacets(facets, getSearchFacets, setSearchFacets);
|
|
20
|
+
const pageTitle = ((_a = frontmatter.seo) === null || _a === void 0 ? void 0 : _a.title) || frontmatter.title || relativePath;
|
|
21
|
+
const pageUrl = route.slug;
|
|
22
|
+
const teamsRbac = staticData[REDOCLY_TEAMS_RBAC];
|
|
23
|
+
const routeRbac = staticData[REDOCLY_ROUTE_RBAC];
|
|
24
|
+
const searchDocuments = [];
|
|
25
|
+
// Add the main page document
|
|
26
|
+
const allText = flattenSectionsText(sections);
|
|
27
|
+
searchDocuments.push({
|
|
28
|
+
id: pageUrl,
|
|
29
|
+
url: pageUrl,
|
|
30
|
+
title: pageTitle,
|
|
31
|
+
text: allText,
|
|
32
|
+
facets,
|
|
33
|
+
[REDOCLY_TEAMS_RBAC]: teamsRbac,
|
|
34
|
+
[REDOCLY_ROUTE_RBAC]: routeRbac,
|
|
35
|
+
});
|
|
36
|
+
// Add individual sections as search documents
|
|
37
|
+
for (const section of sections) {
|
|
38
|
+
addSectionDocuments(section, pageUrl, pageTitle, facets, teamsRbac, routeRbac, searchDocuments);
|
|
39
|
+
}
|
|
40
|
+
return searchDocuments;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function addSectionDocuments(section, pageUrl, pageTitle, facets, teamsRbac, routeRbac, documents) {
|
|
44
|
+
if (section.textContent) {
|
|
45
|
+
const sectionUrl = `${pageUrl}#${section.id}`;
|
|
46
|
+
documents.push({
|
|
47
|
+
id: sectionUrl,
|
|
48
|
+
url: sectionUrl,
|
|
49
|
+
title: section.title,
|
|
50
|
+
text: section.textContent,
|
|
51
|
+
path: [pageTitle, section.title],
|
|
52
|
+
facets,
|
|
53
|
+
[REDOCLY_TEAMS_RBAC]: teamsRbac,
|
|
54
|
+
[REDOCLY_ROUTE_RBAC]: routeRbac,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
for (const child of section.children) {
|
|
58
|
+
addSectionDocuments(child, pageUrl, pageTitle, facets, teamsRbac, routeRbac, documents);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function flattenSectionsText(sections) {
|
|
62
|
+
const parts = [];
|
|
63
|
+
for (const section of sections) {
|
|
64
|
+
if (section.textContent)
|
|
65
|
+
parts.push(section.textContent);
|
|
66
|
+
if (section.children.length) {
|
|
67
|
+
parts.push(flattenSectionsText(section.children));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return parts.join('\n');
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=search-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-resolver.js","sourceRoot":"","sources":["../src/search-resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAMzE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE1F,MAAM,UAAU,cAAc,CAC5B,WAAgC,EAChC,YAAoB,EACpB,QAA2B,EAC3B,eAA+C,EAC/C,eAAiE;IAEjE,OAAO,CAAO,KAAuB,EAAE,UAAmC,EAAE,EAAE;;QAC5E,IAAI,WAAW,CAAC,iBAAiB;YAAE,OAAO,EAAE,CAAC;QAE7C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AG,OAAO,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QAC9C,SAAS,CAAC,IAAI,CAAC;YACb,EAAE,EAAE,UAAU;YACd,GAAG,EAAE,UAAU;YACf,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,IAAI,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;YAChC,MAAM;YACN,CAAC,kBAAkB,CAAC,EAAE,SAAS;YAC/B,CAAC,kBAAkB,CAAC,EAAE,SAAS;SAChC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,QAA2B;IACtD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,WAAW;YAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACzD,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AsciidocFrontmatter, AsciidocSection, ContentNode } from './types.js';
|
|
3
|
+
type PageProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
contentNodes: ContentNode[];
|
|
6
|
+
sections: AsciidocSection[];
|
|
7
|
+
links: Array<{
|
|
8
|
+
href: string;
|
|
9
|
+
text: string;
|
|
10
|
+
type: string;
|
|
11
|
+
}>;
|
|
12
|
+
frontmatter: AsciidocFrontmatter;
|
|
13
|
+
};
|
|
14
|
+
type AsciidocDocsProps = {
|
|
15
|
+
pageProps: PageProps;
|
|
16
|
+
};
|
|
17
|
+
declare const Template: React.FC<AsciidocDocsProps>;
|
|
18
|
+
export default Template;
|
package/lib/template.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Admonition, CodeBlock, Markdown, useThemeHooks } from '@redocly/theme';
|
|
5
|
+
import { DocumentationLayout } from '@redocly/theme/layouts/DocumentationLayout';
|
|
6
|
+
import { TableOfContent } from '@redocly/theme/components/TableOfContent/TableOfContent';
|
|
7
|
+
import { Heading } from '@redocly/theme/markdoc/components/Heading/Heading';
|
|
8
|
+
import { CDNIcon } from '@redocly/theme/icons/CDNIcon/CDNIcon';
|
|
9
|
+
function buildTocHeadings(sections) {
|
|
10
|
+
const items = [];
|
|
11
|
+
for (const section of sections) {
|
|
12
|
+
items.push({ id: section.id, value: section.title, depth: section.level });
|
|
13
|
+
if (section.children.length > 0) {
|
|
14
|
+
items.push(...buildTocHeadings(section.children));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return items;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Renders an HTML string that may contain `<!--icon:N-->` placeholders,
|
|
21
|
+
* splitting the HTML and interleaving CDNIcon React components.
|
|
22
|
+
*/
|
|
23
|
+
function renderHtmlWithIcons(html, icons, keyPrefix) {
|
|
24
|
+
if (!icons.length || !html.includes('<!--icon:')) {
|
|
25
|
+
return _jsx("span", { dangerouslySetInnerHTML: { __html: html } }, keyPrefix);
|
|
26
|
+
}
|
|
27
|
+
const parts = html.split(/(<!--icon:\d+-->)/);
|
|
28
|
+
const nodes = [];
|
|
29
|
+
for (let j = 0; j < parts.length; j++) {
|
|
30
|
+
const fragment = parts[j];
|
|
31
|
+
const iconMatch = fragment.match(/<!--icon:(\d+)-->/);
|
|
32
|
+
if (iconMatch) {
|
|
33
|
+
const idx = parseInt(iconMatch[1], 10);
|
|
34
|
+
const icon = icons[idx];
|
|
35
|
+
if (icon) {
|
|
36
|
+
nodes.push(_jsx(CDNIcon, { name: icon.name, type: icon.style, size: icon.size }, `${keyPrefix}-icon-${idx}`));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (fragment) {
|
|
40
|
+
nodes.push(_jsx("span", { dangerouslySetInnerHTML: { __html: fragment } }, `${keyPrefix}-f-${j}`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return _jsx(_Fragment, { children: nodes });
|
|
44
|
+
}
|
|
45
|
+
function injectCalloutBadges(html, callouts) {
|
|
46
|
+
if (!callouts.length)
|
|
47
|
+
return html;
|
|
48
|
+
const calloutByLine = new Map(callouts.map((c) => [c.line, c.number]));
|
|
49
|
+
let lineNumber = 0;
|
|
50
|
+
return html.replace(/<span class="line">(.*?)<\/span>/g, (match, inner) => {
|
|
51
|
+
lineNumber++;
|
|
52
|
+
const calloutNumber = calloutByLine.get(lineNumber);
|
|
53
|
+
if (calloutNumber != null) {
|
|
54
|
+
return `<span class="line">${inner}<span class="code-callout-badge" data-callout="${calloutNumber}">${calloutNumber}</span></span>`;
|
|
55
|
+
}
|
|
56
|
+
return match;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function AsciidocCodeBlock({ node }) {
|
|
60
|
+
var _a;
|
|
61
|
+
const { useCodeHighlight } = useThemeHooks();
|
|
62
|
+
const { highlight } = useCodeHighlight() || {};
|
|
63
|
+
const highlightLines = (_a = node.callouts) === null || _a === void 0 ? void 0 : _a.map((c) => String(c.line)).join(',');
|
|
64
|
+
const highlightedHtml = useMemo(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
if (!highlight)
|
|
67
|
+
return undefined;
|
|
68
|
+
let html = highlight(node.source, node.lang, {
|
|
69
|
+
highlight: highlightLines,
|
|
70
|
+
});
|
|
71
|
+
if (html && ((_a = node.callouts) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
72
|
+
html = injectCalloutBadges(html, node.callouts);
|
|
73
|
+
}
|
|
74
|
+
return html || undefined;
|
|
75
|
+
}, [highlight, node.source, node.lang, highlightLines, node.callouts]);
|
|
76
|
+
return (_jsx(CodeBlock, { lang: node.lang, source: node.source, highlightedHtml: highlightedHtml, header: node.title || node.lang
|
|
77
|
+
? {
|
|
78
|
+
title: node.title || node.lang,
|
|
79
|
+
controls: { copy: {} },
|
|
80
|
+
}
|
|
81
|
+
: { controls: { copy: {} } } }));
|
|
82
|
+
}
|
|
83
|
+
// Counter to track heading index for PageActions (Copy button shown on first heading)
|
|
84
|
+
let headingCounter = 0;
|
|
85
|
+
function RenderNode({ node, index, }) {
|
|
86
|
+
const key = `node-${index}`;
|
|
87
|
+
switch (node.type) {
|
|
88
|
+
case 'section': {
|
|
89
|
+
const __idx = headingCounter++;
|
|
90
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Heading, { level: node.level, id: node.id, __idx: __idx, children: renderHtmlWithIcons(node.titleHtml, node.titleIcons, `${key}-title`) }), _jsx(RenderNodes, { nodes: node.children, keyPrefix: key })] }, key));
|
|
91
|
+
}
|
|
92
|
+
case 'heading': {
|
|
93
|
+
const __idx = headingCounter++;
|
|
94
|
+
return (_jsx(Heading, { level: node.level, id: node.id, __idx: __idx, children: _jsx("span", { dangerouslySetInnerHTML: { __html: node.contentHtml } }) }, key));
|
|
95
|
+
}
|
|
96
|
+
case 'paragraph': {
|
|
97
|
+
const Tag = node.role ? 'div' : 'p';
|
|
98
|
+
const className = node.role || undefined;
|
|
99
|
+
return (_jsx(Tag, { className: className, children: renderHtmlWithIcons(node.contentHtml, node.icons, key) }, key));
|
|
100
|
+
}
|
|
101
|
+
case 'codeBlock': {
|
|
102
|
+
return (_jsxs(React.Fragment, { children: [_jsx(AsciidocCodeBlock, { node: node }), node.calloutDescriptions && node.calloutDescriptions.length > 0 && (_jsx("ol", { className: "callout-list", children: node.calloutDescriptions.map((desc, i) => (_jsxs("li", { children: [_jsx("span", { className: "callout-badge", children: i + 1 }), _jsx("span", { dangerouslySetInnerHTML: { __html: desc } })] }, `${key}-co-${i}`))) }))] }, key));
|
|
103
|
+
}
|
|
104
|
+
case 'admonition':
|
|
105
|
+
return (_jsx(Admonition, { type: node.admonitionType, name: node.name, children: _jsx(RenderNodes, { nodes: node.children, keyPrefix: key }) }, key));
|
|
106
|
+
case 'list': {
|
|
107
|
+
const ListTag = node.ordered ? 'ol' : 'ul';
|
|
108
|
+
return (_jsx(ListTag, { className: "md", children: node.items.map((item, i) => (_jsx(RenderListItem, { item: item, keyPrefix: `${key}-li-${i}` }, `${key}-li-${i}`))) }, key));
|
|
109
|
+
}
|
|
110
|
+
case 'descriptionList':
|
|
111
|
+
return (_jsx("dl", { className: "dlist", children: node.items.map((item, i) => (_jsx(RenderDlistItem, { item: item, keyPrefix: `${key}-dl-${i}` }, `${key}-dl-${i}`))) }, key));
|
|
112
|
+
case 'table':
|
|
113
|
+
return (_jsx("div", { className: "md-table-wrapper", children: _jsxs("table", { className: "md", children: [node.title && _jsx("caption", { children: node.title }), node.head.length > 0 && (_jsx("thead", { children: node.head.map((row, ri) => (_jsx("tr", { children: row.map((cell, ci) => (_jsx(RenderTableCell, { cell: cell, tag: "th" }, `${key}-th-${ri}-${ci}`))) }, `${key}-th-${ri}`))) })), _jsx("tbody", { children: node.body.map((row, ri) => (_jsx("tr", { children: row.map((cell, ci) => (_jsx(RenderTableCell, { cell: cell, tag: "td" }, `${key}-tb-${ri}-${ci}`))) }, `${key}-tb-${ri}`))) }), node.foot.length > 0 && (_jsx("tfoot", { children: node.foot.map((row, ri) => (_jsx("tr", { children: row.map((cell, ci) => (_jsx(RenderTableCell, { cell: cell, tag: "td" }, `${key}-tf-${ri}-${ci}`))) }, `${key}-tf-${ri}`))) }))] }) }, key));
|
|
114
|
+
case 'image':
|
|
115
|
+
return (_jsxs("div", { className: "imageblock", children: [_jsx("img", Object.assign({ src: node.src, alt: node.alt }, (node.width ? { width: node.width } : {}), (node.height ? { height: node.height } : {}))), node.title && _jsx("div", { className: "title", children: node.title })] }, key));
|
|
116
|
+
case 'quote':
|
|
117
|
+
return (_jsxs("div", { className: "quoteblock", children: [_jsx("blockquote", { children: _jsx(RenderNodes, { nodes: node.children, keyPrefix: key }) }), node.attribution && (_jsxs("div", { className: "attribution", children: ["\u2014 ", node.attribution, node.citeTitle && (_jsxs(_Fragment, { children: [", ", _jsx("cite", { children: node.citeTitle })] }))] }))] }, key));
|
|
118
|
+
case 'sidebar':
|
|
119
|
+
return (_jsx("div", { className: "sidebarblock", children: _jsxs("div", { className: "content", children: [node.title && _jsx("div", { className: "title", children: node.title }), _jsx(RenderNodes, { nodes: node.children, keyPrefix: key })] }) }, key));
|
|
120
|
+
case 'example':
|
|
121
|
+
return (_jsx("div", { className: "exampleblock", children: _jsxs("div", { className: "content", children: [node.title && _jsx("div", { className: "title", children: node.title }), _jsx(RenderNodes, { nodes: node.children, keyPrefix: key })] }) }, key));
|
|
122
|
+
case 'collapsible':
|
|
123
|
+
return (_jsxs("details", { children: [node.title && _jsx("summary", { children: node.title }), _jsx(RenderNodes, { nodes: node.children, keyPrefix: key })] }, key));
|
|
124
|
+
case 'thematicBreak':
|
|
125
|
+
return _jsx("hr", {}, key);
|
|
126
|
+
case 'htmlPassthrough':
|
|
127
|
+
return _jsx("div", { dangerouslySetInnerHTML: { __html: node.html } }, key);
|
|
128
|
+
default:
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function RenderNodes({ nodes, keyPrefix, }) {
|
|
133
|
+
return (_jsx(_Fragment, { children: nodes.map((node, i) => (_jsx(RenderNode, { node: node, index: i }, `${keyPrefix}-${i}`))) }));
|
|
134
|
+
}
|
|
135
|
+
function RenderListItem({ item, keyPrefix, }) {
|
|
136
|
+
return (_jsxs("li", { children: [renderHtmlWithIcons(item.contentHtml, item.icons, keyPrefix), item.children.length > 0 && _jsx(RenderNodes, { nodes: item.children, keyPrefix: keyPrefix })] }));
|
|
137
|
+
}
|
|
138
|
+
function RenderDlistItem({ item, keyPrefix, }) {
|
|
139
|
+
return (_jsxs(_Fragment, { children: [item.termsHtml.map((termHtml, ti) => (_jsx("dt", { dangerouslySetInnerHTML: { __html: termHtml } }, `${keyPrefix}-dt-${ti}`))), _jsxs("dd", { children: [renderHtmlWithIcons(item.descriptionHtml, item.descriptionIcons, `${keyPrefix}-dd`), item.children.length > 0 && (_jsx(RenderNodes, { nodes: item.children, keyPrefix: `${keyPrefix}-dd` }))] })] }));
|
|
140
|
+
}
|
|
141
|
+
function RenderTableCell({ cell, tag: Tag, }) {
|
|
142
|
+
return (_jsx(Tag, Object.assign({}, (cell.colSpan ? { colSpan: cell.colSpan } : {}), (cell.rowSpan ? { rowSpan: cell.rowSpan } : {}), { dangerouslySetInnerHTML: { __html: cell.contentHtml } })));
|
|
143
|
+
}
|
|
144
|
+
const Template = ({ pageProps }) => {
|
|
145
|
+
const { useSidebarSiblingsData } = useThemeHooks();
|
|
146
|
+
const { nextPage, prevPage } = useSidebarSiblingsData() || {};
|
|
147
|
+
const [wrapperElement, setWrapperElement] = useState(null);
|
|
148
|
+
const wrapperRefCb = useCallback((node) => {
|
|
149
|
+
if (!node)
|
|
150
|
+
return;
|
|
151
|
+
setWrapperElement(node);
|
|
152
|
+
}, []);
|
|
153
|
+
const tocHeadings = useMemo(() => {
|
|
154
|
+
const items = buildTocHeadings(pageProps.sections);
|
|
155
|
+
return items.filter((item) => Boolean(item.id) && Boolean(item.value));
|
|
156
|
+
}, [pageProps.sections]);
|
|
157
|
+
const tableOfContent = _jsx(TableOfContent, { headings: tocHeadings, contentWrapper: wrapperElement });
|
|
158
|
+
// Reset heading counter for each page render (used for __idx tracking)
|
|
159
|
+
headingCounter = 0;
|
|
160
|
+
return (_jsx(DocumentationLayout, { tableOfContent: tableOfContent, feedback: undefined, nextPage: nextPage, prevPage: prevPage, children: _jsx(AsciidocWrapper, { ref: wrapperRefCb, as: "div", className: "asciidoc-content", children: _jsx(RenderNodes, { nodes: pageProps.contentNodes, keyPrefix: "root" }) }) }));
|
|
161
|
+
};
|
|
162
|
+
export default Template;
|
|
163
|
+
const AsciidocWrapper = styled(Markdown) `
|
|
164
|
+
/* === Fix list item <p> margins === */
|
|
165
|
+
li > p:only-child {
|
|
166
|
+
margin: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
li > .paragraph:first-child > p:first-child {
|
|
170
|
+
margin-top: 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
li > .paragraph:last-child > p:last-child {
|
|
174
|
+
margin-bottom: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
li > p:first-child {
|
|
178
|
+
margin-top: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
li > p:last-child {
|
|
182
|
+
margin-bottom: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* === AsciiDoc description lists === */
|
|
186
|
+
.dlist dt,
|
|
187
|
+
dl.dlist dt {
|
|
188
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
189
|
+
margin-top: var(--spacing-xs, 0.5em);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.dlist dd,
|
|
193
|
+
dl.dlist dd {
|
|
194
|
+
margin-left: var(--md-list-left-padding, 1.25rem);
|
|
195
|
+
margin-bottom: calc(var(--spacing-xxs, 0.25em) / 2);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* === AsciiDoc images === */
|
|
199
|
+
.imageblock {
|
|
200
|
+
margin: var(--spacing-base, 1em) 0;
|
|
201
|
+
text-align: center;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.imageblock img {
|
|
205
|
+
max-width: 100%;
|
|
206
|
+
height: auto;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.imageblock .title {
|
|
210
|
+
font-style: italic;
|
|
211
|
+
margin-top: var(--spacing-xxs, 0.25em);
|
|
212
|
+
color: var(--text-color-secondary, #666);
|
|
213
|
+
font-size: var(--font-size-sm, 0.875em);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* === AsciiDoc quote blocks === */
|
|
217
|
+
.quoteblock {
|
|
218
|
+
margin: var(--md-blockquote-margin-vertical, 1em) var(--md-blockquote-margin-horizontal, 0);
|
|
219
|
+
padding: var(--md-blockquote-padding-vertical, 0.5em) var(--md-blockquote-padding-horizontal, 1em);
|
|
220
|
+
border-left: var(--md-blockquote-border-left, 3px solid var(--border-color-secondary, #ddd));
|
|
221
|
+
background-color: var(--md-blockquote-bg-color, transparent);
|
|
222
|
+
color: var(--md-blockquote-text-color, var(--text-color-secondary, #666));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.quoteblock blockquote {
|
|
226
|
+
margin: 0;
|
|
227
|
+
padding: 0;
|
|
228
|
+
border: none;
|
|
229
|
+
background: transparent;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.quoteblock .attribution {
|
|
233
|
+
margin-top: var(--spacing-xs, 0.5em);
|
|
234
|
+
font-style: italic;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* === AsciiDoc sidebar blocks === */
|
|
238
|
+
.sidebarblock {
|
|
239
|
+
margin: var(--spacing-base, 1em) 0;
|
|
240
|
+
padding: var(--spacing-sm, 0.75em) var(--spacing-base, 1em);
|
|
241
|
+
background-color: var(--layer-color, #f8f8f8);
|
|
242
|
+
border-radius: var(--border-radius-lg, 6px);
|
|
243
|
+
border: 1px solid var(--border-color-secondary, #e0e0e0);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.sidebarblock > .content > .title {
|
|
247
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
248
|
+
margin-bottom: var(--spacing-xs, 0.5em);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* === AsciiDoc example blocks === */
|
|
252
|
+
.exampleblock > .content {
|
|
253
|
+
padding: var(--spacing-sm, 0.75em) var(--spacing-base, 1em);
|
|
254
|
+
border: 1px solid var(--border-color-secondary, #e0e0e0);
|
|
255
|
+
border-radius: var(--border-radius-lg, 6px);
|
|
256
|
+
margin: var(--spacing-xs, 0.5em) 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* === Callout badges in code blocks === */
|
|
260
|
+
.code-callout-badge {
|
|
261
|
+
display: inline-flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
min-width: 1.25em;
|
|
265
|
+
height: 1.25em;
|
|
266
|
+
border-radius: 50%;
|
|
267
|
+
background-color: var(--callout-badge-bg, #333);
|
|
268
|
+
color: var(--callout-badge-color, #fff);
|
|
269
|
+
font-size: 0.75em;
|
|
270
|
+
font-weight: 600;
|
|
271
|
+
margin-left: 0.5em;
|
|
272
|
+
vertical-align: middle;
|
|
273
|
+
user-select: none;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* === Callout lists === */
|
|
277
|
+
.callout-list {
|
|
278
|
+
margin-top: var(--spacing-xs, 0.5em);
|
|
279
|
+
margin-bottom: var(--spacing-base, 1em);
|
|
280
|
+
padding-left: 0;
|
|
281
|
+
list-style: none;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.callout-list li {
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: baseline;
|
|
287
|
+
gap: 0.5em;
|
|
288
|
+
margin-bottom: 0.25em;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.callout-badge {
|
|
292
|
+
display: inline-flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
min-width: 1.25em;
|
|
296
|
+
height: 1.25em;
|
|
297
|
+
border-radius: 50%;
|
|
298
|
+
background-color: var(--callout-badge-bg, #333);
|
|
299
|
+
color: var(--callout-badge-color, #fff);
|
|
300
|
+
font-size: 0.75em;
|
|
301
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
302
|
+
flex-shrink: 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* === AsciiDoc roles (custom CSS classes) === */
|
|
306
|
+
.underline {
|
|
307
|
+
text-decoration: underline;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.line-through {
|
|
311
|
+
text-decoration: line-through;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.text-center {
|
|
315
|
+
text-align: center;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.text-right {
|
|
319
|
+
text-align: right;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/* === AsciiDoc footer rows === */
|
|
323
|
+
table tfoot {
|
|
324
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
325
|
+
background-color: var(--layer-color, #f8f8f8);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* === Collapsible blocks === */
|
|
329
|
+
details {
|
|
330
|
+
margin: var(--spacing-base, 1em) 0;
|
|
331
|
+
border: 1px solid var(--border-color-secondary, #e0e0e0);
|
|
332
|
+
border-radius: var(--border-radius-lg, 6px);
|
|
333
|
+
padding: var(--spacing-sm, 0.75em) var(--spacing-base, 1em);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
details summary {
|
|
337
|
+
cursor: pointer;
|
|
338
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
339
|
+
margin-bottom: var(--spacing-xs, 0.5em);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
details[open] summary {
|
|
343
|
+
margin-bottom: var(--spacing-sm, 0.75em);
|
|
344
|
+
}
|
|
345
|
+
`;
|
|
346
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.tsx"],"names":[],"mappings":";AAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsLvC,CAAC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type AsciidocFrontmatter = {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
keywords?: string[];
|
|
5
|
+
excludeFromSearch?: boolean;
|
|
6
|
+
seo?: {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type ContentNode = ParagraphNode | HeadingNode | CodeBlockNode | AdmonitionNode | ListNode | DescriptionListNode | TableNode | ImageNode | QuoteNode | SidebarNode | ExampleNode | CollapsibleNode | ThematicBreakNode | HtmlPassthroughNode | SectionNode;
|
|
12
|
+
export type ParagraphNode = {
|
|
13
|
+
type: 'paragraph';
|
|
14
|
+
contentHtml: string;
|
|
15
|
+
icons: InlineIcon[];
|
|
16
|
+
role?: string;
|
|
17
|
+
};
|
|
18
|
+
export type HeadingNode = {
|
|
19
|
+
type: 'heading';
|
|
20
|
+
level: number;
|
|
21
|
+
id: string;
|
|
22
|
+
contentHtml: string;
|
|
23
|
+
};
|
|
24
|
+
export type CodeBlockCallout = {
|
|
25
|
+
line: number;
|
|
26
|
+
number: number;
|
|
27
|
+
};
|
|
28
|
+
export type CodeBlockNode = {
|
|
29
|
+
type: 'codeBlock';
|
|
30
|
+
lang: string;
|
|
31
|
+
source: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
callouts?: CodeBlockCallout[];
|
|
34
|
+
calloutDescriptions?: string[];
|
|
35
|
+
};
|
|
36
|
+
export type AdmonitionNode = {
|
|
37
|
+
type: 'admonition';
|
|
38
|
+
admonitionType: 'info' | 'warning' | 'success' | 'danger';
|
|
39
|
+
name: string;
|
|
40
|
+
children: ContentNode[];
|
|
41
|
+
};
|
|
42
|
+
export type ListNode = {
|
|
43
|
+
type: 'list';
|
|
44
|
+
ordered: boolean;
|
|
45
|
+
items: ListItemNode[];
|
|
46
|
+
};
|
|
47
|
+
export type ListItemNode = {
|
|
48
|
+
contentHtml: string;
|
|
49
|
+
icons: InlineIcon[];
|
|
50
|
+
children: ContentNode[];
|
|
51
|
+
};
|
|
52
|
+
export type DescriptionListNode = {
|
|
53
|
+
type: 'descriptionList';
|
|
54
|
+
items: DescriptionListItemNode[];
|
|
55
|
+
};
|
|
56
|
+
export type DescriptionListItemNode = {
|
|
57
|
+
termsHtml: string[];
|
|
58
|
+
descriptionHtml: string;
|
|
59
|
+
descriptionIcons: InlineIcon[];
|
|
60
|
+
children: ContentNode[];
|
|
61
|
+
};
|
|
62
|
+
export type TableNode = {
|
|
63
|
+
type: 'table';
|
|
64
|
+
title?: string;
|
|
65
|
+
head: TableCellNode[][];
|
|
66
|
+
body: TableCellNode[][];
|
|
67
|
+
foot: TableCellNode[][];
|
|
68
|
+
};
|
|
69
|
+
export type TableCellNode = {
|
|
70
|
+
contentHtml: string;
|
|
71
|
+
colSpan?: number;
|
|
72
|
+
rowSpan?: number;
|
|
73
|
+
};
|
|
74
|
+
export type ImageNode = {
|
|
75
|
+
type: 'image';
|
|
76
|
+
src: string;
|
|
77
|
+
alt: string;
|
|
78
|
+
title?: string;
|
|
79
|
+
width?: string;
|
|
80
|
+
height?: string;
|
|
81
|
+
};
|
|
82
|
+
export type QuoteNode = {
|
|
83
|
+
type: 'quote';
|
|
84
|
+
attribution?: string;
|
|
85
|
+
citeTitle?: string;
|
|
86
|
+
children: ContentNode[];
|
|
87
|
+
};
|
|
88
|
+
export type SidebarNode = {
|
|
89
|
+
type: 'sidebar';
|
|
90
|
+
title?: string;
|
|
91
|
+
children: ContentNode[];
|
|
92
|
+
};
|
|
93
|
+
export type ExampleNode = {
|
|
94
|
+
type: 'example';
|
|
95
|
+
title?: string;
|
|
96
|
+
children: ContentNode[];
|
|
97
|
+
};
|
|
98
|
+
export type CollapsibleNode = {
|
|
99
|
+
type: 'collapsible';
|
|
100
|
+
title?: string;
|
|
101
|
+
children: ContentNode[];
|
|
102
|
+
};
|
|
103
|
+
export type ThematicBreakNode = {
|
|
104
|
+
type: 'thematicBreak';
|
|
105
|
+
};
|
|
106
|
+
export type HtmlPassthroughNode = {
|
|
107
|
+
type: 'htmlPassthrough';
|
|
108
|
+
html: string;
|
|
109
|
+
};
|
|
110
|
+
export type SectionNode = {
|
|
111
|
+
type: 'section';
|
|
112
|
+
id: string;
|
|
113
|
+
title: string;
|
|
114
|
+
titleHtml: string;
|
|
115
|
+
titleIcons: InlineIcon[];
|
|
116
|
+
level: number;
|
|
117
|
+
children: ContentNode[];
|
|
118
|
+
};
|
|
119
|
+
export type InlineIcon = {
|
|
120
|
+
name: string;
|
|
121
|
+
style: string;
|
|
122
|
+
size?: string;
|
|
123
|
+
};
|
|
124
|
+
export type AsciidocSection = {
|
|
125
|
+
id: string;
|
|
126
|
+
title: string;
|
|
127
|
+
level: number;
|
|
128
|
+
textContent: string;
|
|
129
|
+
children: AsciidocSection[];
|
|
130
|
+
};
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@redocly/realm-plugin-asciidoc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AsciiDoc plugin for Redocly Realm",
|
|
5
|
+
"author": "team@redocly.com",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "lib/plugin.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./lib/plugin.js",
|
|
11
|
+
"./plugin.js": "./lib/plugin.js",
|
|
12
|
+
"./template": "./lib/template.js",
|
|
13
|
+
"./template.js": "./lib/template.js",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"redocly",
|
|
18
|
+
"realm",
|
|
19
|
+
"asciidoc",
|
|
20
|
+
"adoc"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@asciidoctor/core": "^3.0.4",
|
|
24
|
+
"@redocly/config": "0.44.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "22.18.13",
|
|
28
|
+
"@types/react": "^19.2.7",
|
|
29
|
+
"@types/styled-components": "5.1.34",
|
|
30
|
+
"rimraf": "5.0.7",
|
|
31
|
+
"typescript": "5.9.3"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "^19.2.4",
|
|
35
|
+
"react-dom": "^19.2.4",
|
|
36
|
+
"@redocly/theme": "0.64.0-next.0",
|
|
37
|
+
"@redocly/realm": "0.132.0-next.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"clean": "rimraf lib",
|
|
41
|
+
"compile": "tsc -p tsconfig.build.json",
|
|
42
|
+
"build": "pnpm run clean && pnpm run compile",
|
|
43
|
+
"watch": "tsc -w -p tsconfig.build.json"
|
|
44
|
+
}
|
|
45
|
+
}
|