import { URI } from "vscode-uri"; import { DendronGlobalConfig } from "."; import { DVault } from "./DVault"; export interface Point { /** * Line in a source file (1-indexed integer). */ line: number; /** * Column in a source file (1-indexed integer). */ column: number; /** * Character in a source file (0-indexed integer). */ offset?: number; } export interface Position { /** * Place of the first character of the parsed source region. */ start: Point; /** * Place of the first character after the parsed source region. */ end: Point; /** * Start column at each index (plus start line) in the source region, * for elements that span multiple lines. */ indent?: number[]; } export declare type DLoc = { fname?: string; id?: string; vaultName?: string; uri?: URI; anchorHeader?: string; }; /** @deprecated use {@link DNoteLink} */ export declare type DLink = { type: "ref" | "wiki" | "md" | "backlink" | "linkCandidate" | "frontmatterTag"; value: string; alias?: string; position?: Position; from: DLoc; to?: DLoc; xvault?: boolean; /** Denotes a same file link, for example `[[#anchor]]` */ sameFile?: boolean; }; export declare type DNodeType = "note" | "schema"; export declare type DNodePointer = string; export declare type DNodeImage = { url: string; alt: string; }; /** * Notes have a config property that can override a subset of {@link dendronConfig} */ export declare type NoteLocalConfig = Partial<{ global: Partial>; }>; export declare type DNodeAllProps = DNodeExplicitPropsEnum & DNodeImplicitPropsEnum; /** * Node property keys that are written to the frontmatter */ export declare enum DNodeExplicitPropsEnum { id = "id", title = "title", desc = "desc", updated = "updated", created = "created", config = "config", color = "color", tags = "tags", traitIds = "traitIds", image = "image" } /** * Node property keys that are not written to the frontmatter */ export declare enum DNodeImplicitPropsEnum { fname = "fname", parent = "parent", children = "children", body = "body", data = "data", schemaStub = "schemaStub", type = "type", custom = "custom", links = "links" } /** * Node property keys that are written to the frontmatter */ export declare type DNodeExplicitProps = { /** * Unique id of a note */ id: string; /** * Node title */ title: string; /** * Node description */ desc: string; /** * Last updated */ updated: number; /** * Created */ created: number; /** * Override of local dendron config */ config?: NoteLocalConfig; }; /** * Props are the official interface for a node */ export declare type DNodeProps = DNodeExplicitProps & { /** * Name of the node. This corresponds to the name of the file minus the extension */ fname: string; /** * Node links (eg. backlinks, wikilinks, etc) */ links: DLink[]; /** * Anchors within the node (headings, block anchors) */ anchors: { [index: string]: DNoteAnchorPositioned | undefined; }; /** * Whether this node is a note or a schema */ type: DNodeType; /** * Determines whether this node is a {@link stub https://wiki.dendron.so/notes/c6fd6bc4-7f75-4cbb-8f34-f7b99bfe2d50.html#stubs} */ stub?: boolean; /** @deprecated */ schemaStub?: boolean; /** * Immediate parent */ parent: DNodePointer | null; /** * Immediate children */ children: DNodePointer[]; data: T; /** * Body of the note */ body: string; /** * Custom frontmatter. Add additional fields here and they will show up in the note frontmatter */ custom?: TCustom; /** * Schemas that apply to the note */ schema?: { moduleId: string; schemaId: string; }; /** * The vault that a note belongs to */ vault: DVault; /** * Hash of note content */ contentHash?: string; /** Override the randomly generated color for tag notes. Colors can be entered as `#12AC35`, `rgb(123, 56, 200)`, or `hsl(235, 100%, 50%)`. */ color?: string; /** One or more frontmatter tags attached to this note. */ tags?: string | string[]; /** To be used by social media platforms as a thumbnail/preview. */ image?: DNodeImage; /** Any note traits that add special behavior to the note */ traits?: string[]; }; export declare type DNodeCompositeKey = Pick & { vaultName?: string; }; export declare type SchemaData = { namespace?: boolean; pattern?: string; template?: SchemaTemplate; isIdAutoGenerated?: boolean; desc?: string; }; export declare type SchemaTemplate = { id: string; type: "snippet" | "note"; }; export declare type SchemaProps = Omit, "body">; /** * Interface for a Dendron Note */ export declare type NoteProps = DNodeProps; /** * Dendron note metadata */ export declare type NotePropsMeta = Omit; /** * Dendron note with optional custom props */ export declare type NotePropsWithOptionalCustom = Omit & Partial<{ custom: any; }>; export declare type SEOProps = { title: string; updated: number; created: number; excerpt?: string; description?: string; image?: DNodeImage; /** * Use as root canonical url for all published notes */ canonicalBaseUrl?: string; canonicalUrl?: string; noindex?: boolean; twitter?: string; }; export declare type DNoteLoc = { fname: string; alias?: string; id?: string; vaultName?: string; anchorHeader?: string; }; export declare type DNoteAnchor = DNoteBlockAnchor | DNoteHeaderAnchor | DNoteLineAnchor; /** * Anchor without {@link DNoteHeaderAnchor.depth} info * @todo see migration [[DNoteAnchorBasic|dendron://dendron.docs/dev.changelog#dnoteanchorbasic]] */ export declare type DNoteAnchorBasic = DNoteBlockAnchor | Omit | DNoteLineAnchor; export declare type DNoteBlockAnchor = { type: "block"; text?: string; value: string; }; /** * This represents a markdown header * ```md * # H1 * ``` */ export declare type DNoteHeaderAnchor = { type: "header"; text?: string; value: string; depth: number; }; /** An anchor referring to a specific line in a file. These don't exist inside of files, they are implied by the link containing the anchor. * * Lines are indexed starting at 1, which is similar to how you refer to specific lines on Github. */ export declare type DNoteLineAnchor = { type: "line"; /** 1-indexed line number. */ line: number; value: string; }; export declare type DNoteAnchorPositioned = (DNoteBlockAnchor | DNoteHeaderAnchor) & { line: number; column: number; };