Skip to content

Commit 73d01b3

Browse files
committed
[docs] MarkdownPage
1 parent 3ef88cd commit 73d01b3

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

site/build.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {Docs} from 'tinydocs';
33
import {createDocs, getSorter} from 'tinydocs';
44
import {ArticleInner} from './ui/ArticleInner.tsx';
55
import {ExecutablePen} from './ui/ExecutablePen.tsx';
6+
import {MarkdownPage} from './ui/MarkdownPage.tsx';
67
import {NavJson} from './ui/NavJson.tsx';
78
import {Page} from './ui/Page.tsx';
89
import {Readme} from './ui/Readme.tsx';
@@ -145,7 +146,11 @@ export const build = async (
145146
.addTextForEachNode('/demos/', ExecutablePen, 'pen.json')
146147
.addPageForNode('/api/', Page, 'all.html', true)
147148
.addMarkdownForNode('/', Readme, '../readme.md')
148-
.addMarkdownForNode('/guides/releases/', Readme, '../../../releases.md');
149+
.addMarkdownForNode(
150+
'/guides/releases/',
151+
MarkdownPage,
152+
'../../../releases.md',
153+
);
149154
}
150155

151156
internalEsm.forEach((module) => {

site/ui/MarkdownPage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type {NoPropComponent} from 'tinydocs';
2+
import {Markdown, usePageNode} from 'tinydocs';
3+
4+
export const MarkdownPage: NoPropComponent = (): any => {
5+
const {summary, body} = usePageNode();
6+
const markdown = summary + '\n\n' + body;
7+
8+
return <Markdown markdown={markdown} html={true} skipCode={true} />;
9+
};

0 commit comments

Comments
 (0)