mirror of
https://github.com/markedjs/marked.git
synced 2026-12-01 16:56:16 +01:00
* fix: add generic types for parser and renderer output * fix types * rename generic variables * add tests
26 lines
745 B
TypeScript
26 lines
745 B
TypeScript
import type { MarkedOptions } from './MarkedOptions.ts';
|
|
|
|
/**
|
|
* Gets the original marked default options.
|
|
*/
|
|
export function _getDefaults<ParserOutput = string, RendererOutput = string>(): MarkedOptions<ParserOutput, RendererOutput> {
|
|
return {
|
|
async: false,
|
|
breaks: false,
|
|
extensions: null,
|
|
gfm: true,
|
|
hooks: null,
|
|
pedantic: false,
|
|
renderer: null,
|
|
silent: false,
|
|
tokenizer: null,
|
|
walkTokens: null,
|
|
};
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export let _defaults: MarkedOptions<any, any> = _getDefaults();
|
|
|
|
export function changeDefaults<ParserOutput = string, RendererOutput = string>(newDefaults: MarkedOptions<ParserOutput, RendererOutput>) {
|
|
_defaults = newDefaults;
|
|
}
|