Something went wrong. Try again.
CLI tool to sync your Markdown to Leaflet
leafletpub atproto cli markdown
Something went wrong. Try again.
928 B · 32 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233import type { PubLeafletContent, PubLeafletPagesLinearDocument } from "@atcute/leaflet";import type { ResourceUri } from "@atcute/lexicons";import type { SiteStandardDocument } from "@atcute/standard-site";
export function generateDoc( tid: string, publicationUri: ResourceUri, blocks: PubLeafletPagesLinearDocument.Block[], title?: string, description?: string, uploadDate?: Date): SiteStandardDocument.Main { const content: PubLeafletContent.Main = { $type: "pub.leaflet.content", pages: [ { $type: "pub.leaflet.pages.linearDocument", blocks: blocks, }, ], };
return { $type: "site.standard.document", path: "/" + tid, site: publicationUri, title: title ? title : "Testing", description: description ? description : "test", publishedAt: uploadDate ? uploadDate.toISOString() : new Date().toISOString(), content: content as any, };}