Markdown syntax migration script

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)
This commit is contained in:
mDuo13
2023-10-31 16:05:38 -07:00
parent cb9f332d78
commit 817ea3732f
8 changed files with 17422 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
import * as React from 'react';
// @ts-ignore
import dynamicReact from '@markdoc/markdoc/dist/react';
import { usePageSharedData } from '@portal/hooks';
import { Link } from '@portal/Link';
export function IndexPageItems() {
const data = usePageSharedData('index-page-items') as any[];
return (
<div className="children-display">
<ul>
{data.map((item: any) => (
<li className="level-1">
<Link to={item.slug}>{item.title}</Link>
<p className='class="blurb child-blurb'>{item.blurb}</p>
</li>
))}
</ul>
</div>
);
}
export function RepoLink(props: {
children: React.ReactNode;
path: string;
github_fork: string;
github_branch: string
}) {
const treeblob = props.path.indexOf(".") >= 0 ? "blob/" : "tree/"
const sep = props.github_fork[-1] == "/" ? "" : "/"
const href = props.github_fork+sep+treeblob+props.github_branch+"/"+props.path
return (
<Link to={href}>{dynamicReact(props.children, React, {})}</Link>
)
}
export function CodePageName(props: {
name: string;
}) {
return (
<code>{props.name}</code>
)
}