ts-markdown
Version:
An extensible TypeScript markdown generator that takes JSON and creates a markdown document.
46 lines (45 loc) • 1.71 kB
TypeScript
import { MarkdownEntryOrPrimitive, MarkdownRenderer, RenderOptions } from '../rendering.types';
import { MarkdownEntry, RichTextEntry } from '../shared.types';
/**
* A markdown entry for generating footnotes.
*/
export interface FootnoteEntry extends MarkdownEntry, RichTextEntry {
/**
* The footnote contents and identifying property for the renderer.
*/
footnote: {
/**
* The footnote ID. This is used inline to signify which footnote to reference.
* Identifiers can be numbers or words, but they cannot contain spaces or tabs.
*/
id: string;
/**
* The footnote content to appear at the bottom of the document.
*/
content: MarkdownEntryOrPrimitive | MarkdownEntryOrPrimitive[];
};
}
/**
* The renderer for footnote entries.
*
* @param entry The footnote entry.
* @param options Document-level render options.
* @returns Footnote ID markdown content.
*/
export declare const footnoteRenderer: MarkdownRenderer;
/**
* The renderer for footnote content at the bottom of the document.
*
* @param data Content to include in the footnote.
* @param document The document to update.
* @param options Document-level options.
* @returns The updated document.
*/
export declare function appendFootnotes(data: MarkdownEntryOrPrimitive[], document: string, options: RenderOptions): string;
/**
* Helper which creates a footnote entry.
*
* @param options Entry-level options for this element.
* @returns a footnote entry
*/
export declare function footnote(id: FootnoteEntry['footnote']['id'], content: FootnoteEntry['footnote']['content'], options?: Omit<FootnoteEntry, 'footnote'>): FootnoteEntry;