import { URI, URIComponents } from './uri'; import { Range } from './range'; import { Position } from './position'; export interface ResourceLink { type: 'wikilink' | 'link' | 'external'; rawText: string; range: Range; isEmbed: boolean; definition?: string | NoteLinkDefinition; } export declare abstract class ResourceLink { /** * Check if this is any kind of reference-style link (resolved or unresolved) */ static isReferenceStyleLink(link: ResourceLink): boolean; /** * Check if this is a reference-style link with unresolved definition */ static isUnresolvedReference(link: ResourceLink): link is ResourceLink & { definition: string; }; /** * Check if this is a reference-style link with resolved definition */ static isResolvedReference(link: ResourceLink): link is ResourceLink & { definition: NoteLinkDefinition; }; /** * Check if this is a regular inline link (not reference-style) */ static isRegularLink(link: ResourceLink): boolean; } export interface NoteLinkDefinition { label: string; url: string; title?: string; range?: Range; } export declare abstract class NoteLinkDefinition { static format(definition: NoteLinkDefinition): string; static isEqual(def1: NoteLinkDefinition, def2: NoteLinkDefinition): boolean; } export interface Tag { label: string; range: Range; } export interface Alias { title: string; range: Range; } export interface Section { label: string; level: number; range: Range; } export type BlockType = 'paragraph' | 'list-item' | 'list' | 'blockquote' | 'code' | 'table' | 'heading'; export interface Block { id: string; /** The range of the block's content (excludes the `^id` marker). */ range: Range; /** The range of the `^id` marker itself */ markerRange: Range; type: BlockType; } export declare abstract class Block { /** * Generates a random block ID suitable for use as a `^blockid` anchor. * Produces 6 lowercase alphanumeric characters, e.g. `"k4f2m1"`. */ static generateId(): string; } export interface Footnote { /** The footnote identifier, e.g. `"1"` for `[^1]` */ id: string; /** Range of the full definition line, e.g. `[^1]: text`. Null if definition is missing. */ definitionRange: Range | null; /** Ranges of each inline reference, e.g. `[^1]` occurrences */ references: Range[]; } export declare abstract class Footnote { static findByPosition(resource: Resource, position: Position): Footnote | null; } export interface Resource { uri: URI; type: string; title: string; properties: any; sections: Section[]; blocks: Block[]; tags: Tag[]; aliases: Alias[]; links: ResourceLink[]; footnotes: Footnote[]; } export interface ResourceParser { parse: (uri: URI, text: string) => Resource; } /** * The plain-data (JSON-safe) form of a {@link Resource}. Identical to Resource * except `uri` is a {@link URIComponents} bag rather than a URI instance. */ export type ResourceJson = Omit & { uri: URIComponents; }; export declare abstract class Resource { static toJSON(resource: Resource): ResourceJson; static fromJSON(data: ResourceJson): Resource; static sortByTitle(a: Resource, b: Resource): number; static sortByPath(a: Resource, b: Resource): number; static isResource(thing: any): thing is Resource; static findSection(resource: Resource, label: string): Section | null; static findBlock(resource: Resource, id: string): Block | null; /** * Returns the deepest section whose range contains the given position, or * undefined if the position does not fall within any section. * * Note: parent sections (e.g. h1) have ranges that extend to the end of the * document and therefore overlap with their child sections (h2, h3, …). * Iterating in reverse start-position order (sections are sorted by start) * ensures the innermost/deepest section is returned. */ static getSectionAtPosition(resource: Resource, position: Position): Section | undefined; } //# sourceMappingURL=note.d.ts.map