UNPKG

roam-export

Version:

A set of tools to Filter/transform/render RoamResearch JSON export. Used in Roam Garden

41 lines (40 loc) 1.75 kB
import { RoamBlock, RoamPage } from "./types"; export interface Filter { makeAllPagesPublic?: boolean; /** * Pages to explicitly make public (mainly used for entry page) */ pagesToMakePublic?: Array<string>; makePagesWithTheseTagsPublic: Array<string>; makeBlocksWithTheseTagsPrivate: Array<string>; } export declare class RoamJsonQuery { readonly allPages: Readonly<RoamPage>[]; readonly filter: Filter; readonly createOrphansForBacklinks: boolean; readonly blockToPage: Map<any, any>; readonly pageByName: Map<string, Readonly<RoamPage>>; readonly pageByUid: Map<string, Readonly<RoamPage>>; orphanId: number; constructor(allPages: Readonly<RoamPage>[], filter: Filter, createOrphansForBacklinks?: boolean); getPagesToRender(): { pages: RoamPage[]; blockUids: Set<string | undefined>; }; private createOrphanPagesWithBlocks; private createOrphansWithReferences; private buildOrphanPages; createOrphanPage: (name: string, blocks?: Readonly<RoamBlock>[]) => RoamPage; removePrivateBlocks: (pages: RoamPage[]) => Readonly<RoamPage | RoamBlock>[]; findPublicPages: (pages: Array<Readonly<RoamPage>>) => Readonly<RoamPage>[]; isPublic: (page: Readonly<RoamPage>) => boolean; private buildBlockToPageMap; /** * This is required to display content of the block in Backlinks/References section * Hence including the blocks that have references to any public pages * TODO: currently these are not rendered and only text is used, so can consider * not creating MDX nodes for these. Though would probably actually move to * using rendered version in the future */ private buildBlocksReferencingPages; }