mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-14 00:35:50 +00:00
Script replacing include_code with code-snippet
Migration script: partials, some variables
Add variables to conversion script
draft repo-link component
Complete repo-link component
Migration script: handle github links
Draft include_svg→inline-svg (non-functional)
Currently doesn't work due to image path issues.
Also, captions and custom classes (for inlining) not implemented yet.
Conversion script: refactor & add code-page-name
Custom code-page-name component works around Markdoc limitation where
vars can't be used in `inline code` sections.
Migrate script: Handle more code includes correctly
Migration script: tabs and tabbed code samples
Child pages macro & conversion script
Adapted from 70cffa67ed
Migration script: update with some partial fixes
Migration script: callouts→admonitions
Fix auto-generation of index pages
Migration script: fix SVG migration
Migration scripting: fix code block prefixes & indentation
- Use the Redocly 0.66 feature for code block prefixes
- Update the script for converting indented code blocks to fences with
Roman's latest fixes (now uses 4 spaces per level, for consistency)
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { Schema, Tag } from '@markdoc/markdoc';
|
|
|
|
export const indexPageList: Schema & { tagName: string } = {
|
|
tagName: 'child-pages',
|
|
render: 'IndexPageItems',
|
|
selfClosing: true,
|
|
};
|
|
|
|
export const repoLink: Schema & { tagName: string } = {
|
|
tagName: 'repo-link',
|
|
attributes: {
|
|
path: {
|
|
type: 'String',
|
|
required: true,
|
|
},
|
|
github_fork: {
|
|
type: 'String',
|
|
required: false,
|
|
},
|
|
github_branch: {
|
|
type: 'String',
|
|
required: false,
|
|
},
|
|
},
|
|
transform(node, config) {
|
|
const attributes = node.transformAttributes(config);
|
|
attributes["github_fork"] = attributes["github_fork"] || config.variables.env.PUBLIC_GITHUB_FORK;
|
|
attributes["github_branch"] = attributes["github_branch"] || config.variables.env.PUBLIC_GITHUB_BRANCH;
|
|
const children = node.transformChildren(config);
|
|
return new Tag(this.render, attributes, children);
|
|
},
|
|
render: 'RepoLink',
|
|
};
|
|
|
|
export const codePageName: Schema & { tagName: string } = {
|
|
tagName: 'code-page-name',
|
|
attributes: {
|
|
name: {
|
|
type: 'String',
|
|
required: false,
|
|
},
|
|
},
|
|
transform(node, config) {
|
|
const attributes = node.transformAttributes(config);
|
|
attributes["name"] = config.variables.frontmatter.seo.title;
|
|
return new Tag(this.render, attributes);
|
|
},
|
|
render: 'CodePageName',
|
|
selfClosing: true,
|
|
}; |