diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 74dfec5317..ad12e6d35e 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -77,6 +77,17 @@ declare namespace marked { */ function setOptions(options: MarkedOptions): typeof marked; + class InlineLexer { + constructor(links: string[], options?: MarkedOptions); + static rules: Rules; + static output(src: string, links: string[], options?: MarkedOptions): string; + output(src: string): string; + static escapes(text: string): string; + outputLink(cap: string[], link: string): string; + smartypants(text: string): string; + mangle(text: string): string; + } + class Renderer { constructor(options?: MarkedOptions); code(code: string, language: string, isEscaped: boolean): string; diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 2af775e397..65cd72ee73 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -56,3 +56,9 @@ const parseTestText = "- list1\n - list1.1\n\n listend"; const parseTestTokens: marked.TokensList = marked.lexer(parseTestText, options); const parser = new marked.Parser(); console.log(parser.parse(parseTestTokens)); + +const links = ['http', 'image']; +const inlineLexer = new marked.InlineLexer(links); +console.log(inlineLexer.output("http://")); +console.log(marked.InlineLexer.output("http://", links)); +console.log(marked.InlineLexer.rules);