本文整理汇总了TypeScript中marked.parse函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parse函数的具体用法?TypeScript parse怎么用?TypeScript parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should sanitize when markedOptions.sanitize is true and no sanitizer function is provided', () => {
const markedOptions: MarkedOptions = { sanitize: true };
const mockRaw = '### Markdown-x';
const sanitized = domSanitizer.sanitize(SecurityContext.HTML, parse(mockRaw));
const unsanitized = parse(mockRaw);
expect(markdownService.compile(mockRaw, false, markedOptions)).toBe(sanitized);
expect(markdownService.compile(mockRaw, false, markedOptions)).not.toBe(unsanitized);
});
示例2: callback
fs.readFile(route.path, (err, data) => {
if (err) {
throw err;
}
var output: string;
if (route.content === '') {
route.content = Marked.parse(removeFrontMatter(data.toString()));
}
page.content = route.content;
callback(res, page);
});
示例3: convertToHtml
convertToHtml(){
return marked.parse(this.markdownInput);
}
示例4: toHtml
toHtml(text: string) {
return marked.parse(text);
}
示例5: ngAfterViewInit
ngAfterViewInit() {
let content: string = this.el.nativeElement.innerHTML
let parsed = marked.parse(content.trim());
this.el.nativeElement.innerHTML = parsed;
}