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
This commit is contained in:
SHIRSH ZIBBU
2019-11-11 15:17:39 -08:00
committed by Pranav Senthilnathan
parent 8c0390d2ef
commit ac74c74ae9
2 changed files with 6 additions and 12 deletions
+1 -6
View File
@@ -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 (<br/> instead of <br>)
*/
+5 -6
View File
@@ -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;