diff options
Diffstat (limited to 'services/blog/nuldoc-src/djot/document.ts')
| -rw-r--r-- | services/blog/nuldoc-src/djot/document.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/blog/nuldoc-src/djot/document.ts b/services/blog/nuldoc-src/djot/document.ts index be9c08d5..3e8cd92c 100644 --- a/services/blog/nuldoc-src/djot/document.ts +++ b/services/blog/nuldoc-src/djot/document.ts @@ -12,6 +12,7 @@ export const PostMetadataSchema = z.object({ title: z.string(), description: z.string(), tags: z.array(z.string()), + toc: z.boolean().optional(), revisions: z.array(z.object({ date: z.string(), remark: z.string(), @@ -22,6 +23,17 @@ export const PostMetadataSchema = z.object({ export type PostMetadata = z.infer<typeof PostMetadataSchema>; +export type TocEntry = { + id: string; + text: string; + level: number; + children: TocEntry[]; +}; + +export type TocRoot = { + entries: TocEntry[]; +}; + export type Document = { root: Element; sourceFilePath: string; @@ -31,6 +43,8 @@ export type Document = { description: string; // TODO: should it be markup text? tags: string[]; revisions: Revision[]; + toc?: TocRoot; + isTocEnabled: boolean; }; export function createNewDocumentFromDjotDocument( @@ -56,5 +70,6 @@ export function createNewDocumentFromDjotDocument( remark: r.remark, isInternal: !!r.isInternal, })), + isTocEnabled: meta.article.toc !== false, }; } |
