Add makred tests and fix marked definitions

This commit is contained in:
Boris Yankov
2013-01-20 07:34:01 +02:00
parent 354ebd4afb
commit 8bdb0efb2b
2 changed files with 41 additions and 14 deletions
+25
View File
@@ -0,0 +1,25 @@
/// <reference path="marked.d.ts" />
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);
+16 -14
View File
@@ -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;
}