ts-markdown
Version:
An extensible TypeScript markdown generator that takes JSON and creates a markdown document.
41 lines (40 loc) • 1.25 kB
TypeScript
import { MarkdownRenderer } from '../rendering.types';
import { InlineTypes, MarkdownEntry } from '../shared.types';
/**
* A markdown entry for generating h2 elements.
*/
export interface H2Entry extends MarkdownEntry {
/**
* The h2 contents and identifying property for the renderer.
*/
h2: InlineTypes;
/**
* Option which will use '-' underlining rather than a '##' prefix.
*/
underline?: boolean;
/**
* Option which will append a markdown heading ID.
* E.g., given the ID 'my-id' and the header 'Header Example',
* `## Header Example {#my-id}`
*/
id?: string;
/**
* Option which will arbitrarily append a string immediately below the h2, ignoring block-level settings.
*/
append?: string;
}
/**
* The renderer for h2 entries.
*
* @param entry The h2 entry.
* @param options Document-level render options.
* @returns Block-level h2 markdown content.
*/
export declare const h2Renderer: MarkdownRenderer;
/**
* Helper which creates a second-level header entry.
*
* @param options Entry-level options for this element.
* @returns a second-level header entry
*/
export declare function h2(content: H2Entry['h2'], options?: Omit<H2Entry, 'h2'>): H2Entry;