当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript marked.default函数代码示例

本文整理汇总了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);*/
    });
开发者ID:cchampernowne,项目名称:project-seed,代码行数:30,代码来源:wiki.ts

示例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;
  }
开发者ID:Mitranim,项目名称:atril,代码行数:25,代码来源:markdown-live.ts

示例3: constructor

 constructor(
   public nav: NavController,
   public navParams: NavParams) {
     this.nav = nav;
     this.provider = navParams.get('item');
     this.synopsis = parse(this.provider.categorySynopsis);
 }
开发者ID:StreetSupport,项目名称:streetsupport-app,代码行数:7,代码来源:help-category-detail.ts

示例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);
}
开发者ID:tristau,项目名称:dnd-5e-srd,代码行数:27,代码来源:index.ts

示例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>`;
}
开发者ID:kjhx,项目名称:og-image,代码行数:27,代码来源:template.ts

示例6: function

 md: function(text: string) {
   if (text && text.length) {
     var html = marked(text, {
       renderer: markedRenderer
     });
     return new handlebars.SafeString(html);
   }
   return '';
 },
开发者ID:bayeslife,项目名称:jsonschema2class,代码行数:9,代码来源:helpers.ts

示例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>`;
 }
开发者ID:CAaRrLl,项目名称:Blog,代码行数:9,代码来源:html.render.ts

示例8: marked

 return new Promise<string>((resolve, reject) => {
   marked(content, (err: any, content: string) => {
     if (err) {
       reject(err);
     } else {
       resolve(content);
     }
   });
 });
开发者ID:jupyter,项目名称:jupyterlab,代码行数:9,代码来源:renderers.ts

示例9: marked

const getLicense = () => {
  return marked(
    fs
      .readFileSync(path.join(process.env.NODE_PATH || ".", "LICENSE.md"))
      .toString()
  )
    .split("\n")
    .slice(1)
    .join("\n");
};
开发者ID:AnandChowdhary,项目名称:mit-license,代码行数:10,代码来源:license.ts

示例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);
 });
开发者ID:irysius,项目名称:NodeSiteTemplate,代码行数:10,代码来源:demos.ts


注:本文中的marked.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。