diff --git a/marked/marked-tests.ts b/marked/marked-tests.ts new file mode 100644 index 000000000..458c0c616 --- /dev/null +++ b/marked/marked-tests.ts @@ -0,0 +1,25 @@ +/// + +import marked = module('marked'); + +marked.setOptions({ + gfm: true, + tables: true, + breaks: false, + pedantic: false, + sanitize: true, + highlight: function(code, lang) { + if (lang === 'js') { + return highlighter.javascript(code); + } + return code; + } +}); +console.log(marked('i am using __markdown__.')); + +var tokens = marked.lexer(text, options); +console.log(marked.parser(tokens)); + +var lexer = new marked.Lexer(options); +var tokens2 = lexer.lex(text); +console.log(lexer.rules); \ No newline at end of file diff --git a/marked/marked.d.ts b/marked/marked.d.ts index a059a3e6a..f669fda26 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -1,14 +1,16 @@ -declare module "marked" { - export function (src: string, opt?: Options): string; - export function lexer(src: string, opt?: Options): Array; - export function parser(src: string, opt?: Options): string; - export function parse(src: string, opt?: Options): string; - export function setOptions(opt: Options): void; -} - -interface Options { - gfm?: bool; - pedantic?: bool; - sanitize?: bool; - highlight?: bool; -} +declare module "marked" { + export function (src: string, opt?: Options): string; + export function lexer(src: string, opt?: Options): Array; + export function parser(src: string, opt?: Options): string; + export function parse(src: string, opt?: Options): string; + export function setOptions(opt: Options): void; +} + +interface Options { + gfm?: bool; + tables?: bool; + breaks?: bool; + pedantic?: bool; + sanitize?: bool; + highlight?: any; +}