CLI tool to sync your Markdown to Leaflet
leafletpub
atproto
cli
markdown
1import type { PubLeafletContent, PubLeafletPagesLinearDocument } from "@atcute/leaflet";
2import type { ResourceUri } from "@atcute/lexicons";
3import type { SiteStandardDocument } from "@atcute/standard-site";
4
5export function generateDoc(
6 tid: string,
7 publicationUri: ResourceUri,
8 blocks: PubLeafletPagesLinearDocument.Block[],
9 title?: string,
10 description?: string,
11 uploadDate?: Date
12): SiteStandardDocument.Main {
13 const content: PubLeafletContent.Main = {
14 $type: "pub.leaflet.content",
15 pages: [
16 {
17 $type: "pub.leaflet.pages.linearDocument",
18 blocks: blocks,
19 },
20 ],
21 };
22
23 return {
24 $type: "site.standard.document",
25 path: "/" + tid,
26 site: publicationUri,
27 title: title ? title : "Testing",
28 description: description ? description : "test",
29 publishedAt: uploadDate ? uploadDate.toISOString() : new Date().toISOString(),
30 content: content as any,
31 };
32}