本文整理匯總了TypeScript中marked.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: marked
wikiContent.forEach(page => {
//console.log("Page names: ", page.pageName);
let wiki_title_template = document.createElement("div");
wiki_title_template.className = "panel panel-default";
let panel_heading = document.createElement("div");
panel_heading.className = "panel-heading";
panel_heading.setAttribute("data-toggle","collapse");
panel_heading.setAttribute("href","#" + "wiki-" + wiki_page_counter);
panel_heading.innerHTML = page.pageName;
let panel_body = document.createElement("div");
panel_body.className = "panel-body collapse";
panel_body.id = "wiki-" + wiki_page_counter;
panel_body.innerHTML = marked(page.pageContent);
wiki_title_template.appendChild(panel_heading);
wiki_title_template.appendChild(panel_body);
wiki_content.appendChild(wiki_title_template);
wiki_page_counter++;
/*let wiki_content_template = document.createElement("div");
wiki_content_template.className = "panel panel-default";
let content_body = document.createElement("div");
content_body.className = "content-body";
content_body.innerHTML = marked(page.pageContent);
wiki_content_template.appendChild(content_body);
wiki_titles.appendChild(wiki_content_template);*/
});
示例2: rewrite
rewrite() {
let value = this.expression(this.scope) || '' + '';
if (value === this.lastValue) return;
this.buffer.innerHTML = marked(value);
// Fix code highlighting classes.
let codeBlocks = this.buffer.querySelectorAll('pre code');
for (let i = 0, ii = codeBlocks.length; i < ii; ++i) {
let node = codeBlocks[i];
if (node instanceof Element) node.classList.add('hljs');
}
// Remove existing content.
while (this.element.hasChildNodes()) {
this.element.removeChild(this.element.firstChild);
}
// Add new content.
while (this.buffer.hasChildNodes()) {
this.element.appendChild(this.buffer.removeChild(this.buffer.firstChild));
}
this.lastValue = value;
}
示例3: constructor
constructor(
public nav: NavController,
public navParams: NavParams) {
this.nav = nav;
this.provider = navParams.get('item');
this.synopsis = parse(this.provider.categorySynopsis);
}
示例4: convertJson
function convertJson(input: string, outputFile: string, keysFile?: string, yamlFile?: string): Promise<void> {
const render = new Renderer();
marked.setOptions({
renderer: render
});
marked(input);
const promises: Array<Promise<void>> = [ writeFilePromise(outputFile, render.getOutput()) ];
if (keysFile) {
let treeKeys: any = {};
addChildKeys(render.getFullObject().children, treeKeys);
let jsonStr = JSON.stringify(treeKeys, null, 4);
promises.push(writeFilePromise(keysFile, jsonStr));
}
if (yamlFile) {
promises.push(writeFilePromise(yamlFile, render.getYamlOutput()));
}
return Promise.all(promises).then(() => undefined);
}
示例5: getHtml
export function getHtml(parsedReq: ParsedRequest) {
const { text, theme, md, fontSize, images, widths, heights } = parsedReq;
return `<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Generated Image</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
${getCss(theme, fontSize)}
</style>
<body>
<div>
<div class="spacer">
<div class="logo-wrapper">
${images.map((img, i) =>
getPlusSign(i) + getImage(img, widths[i], heights[i])
).join('')}
</div>
<div class="spacer">
<div class="heading">${emojify(
md ? marked(text) : sanitizeHtml(text)
)}
</div>
</div>
</body>
</html>`;
}
示例6: function
md: function(text: string) {
if (text && text.length) {
var html = marked(text, {
renderer: markedRenderer
});
return new handlebars.SafeString(html);
}
return '';
},
示例7: makedownTohtml
makedownTohtml() {
if(!this.html) return '';
let marked = require('marked');
let html = marked(this.html);
return `<div class="markdown-body">
<h1>${this.title}</h1>
${html}
</div>`;
}
示例8: marked
return new Promise<string>((resolve, reject) => {
marked(content, (err: any, content: string) => {
if (err) {
reject(err);
} else {
resolve(content);
}
});
});
示例9: marked
const getLicense = () => {
return marked(
fs
.readFileSync(path.join(process.env.NODE_PATH || ".", "LICENSE.md"))
.toString()
)
.split("\n")
.slice(1)
.join("\n");
};
示例10: function
fs.readFile('../Markdown.md', function (err, data) {
// Assuming we're reading UTF-8, we strip the byte order mark (3 bytes).
var content = data.toString('utf8', 3);
var model = {
title: 'Markdown Demo',
raw: content,
parsed: marked(content)
};
res.render(root + '/markdown', model);
});