Documentation Updates (#79)

* Docs: Added Shadcn sidebar; added algorithm to automatically infer parents without needing to specify it.
* Extracted Markdoc compilation in a separate file
* Site Navigation: simplify nav by removing the border
* Docs Navigation: added TOC; improved layout on mobile
This commit is contained in:
Giancarlo Buomprisco
2024-10-30 13:49:44 +01:00
committed by GitHub
parent 6490102e9f
commit 9615d1a4bb
20 changed files with 551 additions and 266 deletions

View File

@@ -0,0 +1,30 @@
import React from 'react';
import { Node } from '@markdoc/markdoc';
import {
CustomMarkdocComponents,
CustomMarkdocTags,
} from './custom-components';
import { MarkdocNodes } from './markdoc-nodes';
/**
* @name renderMarkdoc
* @description Renders a Markdoc tree to React
*/
export async function renderMarkdoc(node: Node) {
const { transform, renderers } = await import('@markdoc/markdoc');
const content = transform(node, {
tags: {
...CustomMarkdocTags,
},
nodes: {
...MarkdocNodes,
},
});
return renderers.react(content, React, {
components: CustomMarkdocComponents,
});
}