From ac74c74ae9a64ab3ce3158fb5cd14670275ab2da Mon Sep 17 00:00:00 2001 From: SHIRSH ZIBBU Date: Tue, 12 Nov 2019 04:47:39 +0530 Subject: [PATCH] Fix marked v0.7 typings (#40098) * Add missing key "checkbox" for marked.Renderer * Update version * Add options, getDefaults & defaults * Add missing semicolons * remove tables option * update tests * fix heading levels to 1 through 6 * remove duplicate `checkbox()` method --- types/marked/index.d.ts | 7 +------ types/marked/marked-tests.ts | 11 +++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index d0ef9632a1..c954283096 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -112,7 +112,7 @@ declare namespace marked { code(code: string, language: string, isEscaped: boolean): string; blockquote(quote: string): string; html(html: string): string; - heading(text: string, level: number, raw: string, slugger: Slugger): string; + heading(text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string, slugger: Slugger): string; hr(): string; list(body: string, ordered: boolean, start: number): string; listitem(text: string): string; @@ -357,11 +357,6 @@ declare namespace marked { */ smartypants?: boolean; - /** - * Enable GFM tables. This option requires the gfm option to be true. - */ - tables?: boolean; - /** * Generate closing slash for self-closing tags (
instead of
) */ diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index c4707f297a..dcdb51180c 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -3,7 +3,6 @@ import * as marked from 'marked'; let options: marked.MarkedOptions = { baseUrl: '', gfm: true, - tables: true, breaks: false, pedantic: false, sanitize: true, @@ -14,14 +13,14 @@ let options: marked.MarkedOptions = { }, langPrefix: 'lang-', smartypants: false, - renderer: new marked.Renderer() + renderer: new marked.Renderer(), }; options = marked.getDefaults(); options = marked.defaults; function callback(err: string, markdown: string) { - console.log("Callback called!"); + console.log('Callback called!'); return markdown; } @@ -64,7 +63,7 @@ const rendererOptions: marked.MarkedOptions = renderer.options; const textRenderer = new marked.TextRenderer(); console.log(textRenderer.strong(text)); -const parseTestText = "- list1\n - list1.1\n\n listend"; +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)); @@ -73,7 +72,7 @@ const parserOptions: marked.MarkedOptions = parser.options; const links = ['http', 'image']; const inlineLexer = new marked.InlineLexer(links); -console.log(inlineLexer.output("http://")); -console.log(marked.InlineLexer.output("http://", links)); +console.log(inlineLexer.output('http://')); +console.log(marked.InlineLexer.output('http://', links)); console.log(marked.InlineLexer.rules); const inlineLexerOptions: marked.MarkedOptions = inlineLexer.options;