@f-fjs/tidy-markdown
Version:
Fix ugly markdown.
31 lines (30 loc) • 1.25 kB
TypeScript
import treeAdapter from './tree-adapter';
export declare type ConverterFilter = ((node: treeAdapter.Node) => boolean) | string | string[];
export interface Link {
url: string;
title: string | null;
name: string;
}
export interface Converter {
surroundingBlankLines?: boolean | {
leading: string;
trailing: string;
} | ((node: treeAdapter.Node) => boolean | {
leading: string;
trailing: string;
});
trailingWhitespace?: string | ((node: treeAdapter.Node) => string);
filter: ConverterFilter;
replacement(content: string, node: treeAdapter.Node, links: Link[]): string;
}
/**
* This array holds a set of "converters" that process DOM nodes and output
* Markdown. The `filter` property determines what nodes the converter is run
* on. The `replacement` function takes the content of the node and the node
* itself and returns a string of Markdown. The `surroundingBlankLines` option
* determines whether or not the block should have a blank line before and after
* it. Converters are matched to nodes starting from the top of the converters
* list and testing each one downwards.
* @type {Array}
*/
export declare const Converters: Converter[];