insta-toc
Version:
Simultaneously generate, update, and maintain a table of contents for your notes in real time.
38 lines (34 loc) • 1.5 kB
text/typescript
import type { PluginTypesBase } from "obsidian-dev-utils/obsidian/plugin/plugin-types-base";
import type InstaTocPlugin from "./Plugin";
import type { PluginSettingsManager } from "./settings/PluginSettingManager";
import type { InstaTocSettings } from "./settings/Settings";
import type { SettingTab } from "./settings/SettingsTab";
export interface PluginTypes extends PluginTypesBase {
plugin: InstaTocPlugin;
pluginSettings: InstaTocSettings;
pluginSettingsManager: PluginSettingsManager;
pluginSettingsTab: SettingTab;
}
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
type LocalTocTitle = { name: string | null; level: HeadingLevel | null; center: boolean | null; };
type LocalTocLevels = { min: HeadingLevel | null; max: HeadingLevel | null; };
export interface LocalTocSettings {
title: LocalTocTitle;
exclude: string | null;
omit: string[] | null;
levels: LocalTocLevels;
}
export type TocBlockTitle = { text: string; level: HeadingLevel; centerOverride: boolean | null; };
export type TocBlockItem = {
key: ItemKey;
text: string;
href: string;
children: TocBlockItem[];
foldKey: FoldKey | null;
initialCollapsed: boolean;
};
export type TocBlockModel = { title: TocBlockTitle | null; items: TocBlockItem[]; };
export type ItemKey = `${FileKey}:${number}`;
export type FileKey = `${string}.md`;
export type FoldKey = `${FileKey}::${number}`;
export type ParseLocalTocSettingsResult = { settings: LocalTocSettings; errors: string[]; };