• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript remark类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中remark的典型用法代码示例。如果您正苦于以下问题:TypeScript remark类的具体用法?TypeScript remark怎么用?TypeScript remark使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了remark类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: remark

    indexArray.forEach(element => {
        let tutData = { link: element["file"] };

        let tutFile = path.resolve(tutFolder, element["file"]);
        let tutFileText = fs.readFileSync(tutFile, "utf8");
        let tutMD = remark().use(frontMatter, ["yaml"]).parse(tutFileText);

        let metadata = getDocMetadata(tutMD);

        if (metadata["Level"]){
            tutData["level"] = metadata["Level"];
        } else {
            tutData["level"] = "";
        }

        let briefDesc = getFirstParagraph(tutMD);

        let briefDescText = remark()
        .use(frontMatter, {type: 'yaml', fence: '---'})
        .data("settings", {paddedTable: false, gfm: false})
        .stringify(briefDesc);

        tutData["briefDesc"] = briefDescText;

        let title = getFirstHeading(tutMD);

        let titleText = remark()
        .use(frontMatter, {type: 'yaml', fence: '---'})
        .data("settings", {paddedTable: false, gfm: false})
        .stringify(title.children[0]);

        tutData["title"] = titleText;

        result.tuts.push(tutData);
    });
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:35,代码来源:tutorialIndex.ts


示例2: remark

        .then((response) => {
            if (!response['data']) {
                console.log(JSON.stringify(response));
            } else {
                //console.log(template(response['data']));
                let newSection = remark().parse(template(response['data'])).children;

                replaceZone(indexMD, libName, (start, _oldZone, end) => {
                    newSection.unshift(start);
                    newSection.push(end);
                    return newSection;
                });

                let outText = remark()
                .use(frontMatter, {type: 'yaml', fence: '---'})
                .data("settings", {paddedTable: false, gfm: false})
                .stringify(indexMD);

                fs.writeFileSync(indexFilePath, outText);
            }
        });
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:21,代码来源:gqIndex.ts


示例3: updateFile

function updateFile(tree, pathname, aggData, errorMessages) {
    /*
    let compName = angNameToClassName(path.basename(pathname, ".md"));
    let classRef = aggData.projData.findReflectionByName(compName);

    if (!classRef) {
        // A doc file with no corresponding class (eg, Document Library Model).
        return false;
    }

    let compData = new ComponentInfo(classRef);
    */

    let className = ngNameToClassName(path.basename(pathname, ".md"), nameExceptions);
    let classTypeMatch = className.match(/component|directive|service/i);
    let compData = aggData.classInfo[className];

    if (classTypeMatch && compData) {
        let classType = classTypeMatch[0].toLowerCase();

        // Copy docs back from the .md file when the JSDocs are empty.
        let inputMD = getPropDocsFromMD(tree, "Properties", 3);
        let outputMD = getPropDocsFromMD(tree, "Events", 2);
        updatePropDocsFromMD(compData, inputMD, outputMD, errorMessages);

        if (classType === "service") {
            let methodMD = getMethodDocsFromMD(tree);
            updateMethodDocsFromMD(compData, methodMD, errorMessages);
        }

        let templateName = path.resolve(templateFolder, classType + ".ejs");
        let templateSource = fs.readFileSync(templateName, "utf8");
        let template = ejs.compile(templateSource);

        let mdText = template(compData);
        mdText = mdText.replace(/^ +\|/mg, "|");

        let newSection = remark().parse(mdText.trim()).children;

        replaceSection(tree, "Class members", (before, section, after) => {
            newSection.unshift(before);
            newSection.push(after);
            return newSection;
        });

        compData.errors.forEach(err => {
            errorMessages.push(err);
        })
    }

    return true;
}
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:52,代码来源:tsInfo.ts


示例4: aggPhase

function aggPhase(aggData) {
    let indexDocData = getIndexDocData();

    let templateName = path.resolve(templateFolder, "tutIndex.ejs");
    let templateSource = fs.readFileSync(templateName, "utf8");
    let template = ejs.compile(templateSource);

    let mdText = template(indexDocData);
    mdText = mdText.replace(/^ +\|/mg, "|");

    let newSection = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children;

    let tutIndexFile = path.resolve(tutFolder, "README.md");
    let tutIndexText = fs.readFileSync(tutIndexFile, "utf8");
    let tutIndexMD = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false, gfm: false}).parse(tutIndexText);

    replaceSection(tutIndexMD, "Tutorials", (before, section, after) => {
        newSection.unshift(before);
        newSection.push(after);
        return newSection;
    });

    fs.writeFileSync(tutIndexFile, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false, gfm: false}).stringify(tutIndexMD));
}
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:24,代码来源:tutorialIndex.ts


示例5: getDocReviewDate

function getDocReviewDate(docFileName) {
  let mdFilePath = path.resolve(docsFolderPath, docFileName);

  let mdText = fs.readFileSync(mdFilePath);
  let tree = remark().use(frontMatter, ["yaml"]).parse(mdText);

  let lastReviewDate = moment(adf20StartDate);

  if (tree.children[0].type == "yaml") {
    let metadata = yaml.load(tree.children[0].value);

    if (metadata["Last reviewed"])
      lastReviewDate = moment(metadata["Last reviewed"]);
  }

  return lastReviewDate;
}
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:17,代码来源:reviewChecker.ts


示例6: processDocs

export function processDocs(mdCache, aggData, _errorMessages) {
    let docset: MQ.Docset = new MQ.Docset(mdCache);

    let templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
    let templateSource = fs.readFileSync(templateFilePath, 'utf8');
    let template = ejs.compile(templateSource);

    let indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
    let indexFileText = fs.readFileSync(indexFilePath, 'utf8');
    let indexMD = remark()
    .use(frontMatter, ["yaml"])
    .parse(indexFileText);

    let schema = buildSchema(MQ.schema);

    libNamesList.forEach(libName => {
        graphql(schema, query, docset, null, {'libName': libName})
        .then((response) => {
            if (!response['data']) {
                console.log(JSON.stringify(response));
            } else {
                //console.log(template(response['data']));
                let newSection = remark().parse(template(response['data'])).children;

                replaceZone(indexMD, libName, (start, _oldZone, end) => {
                    newSection.unshift(start);
                    newSection.push(end);
                    return newSection;
                });

                let outText = remark()
                .use(frontMatter, {type: 'yaml', fence: '---'})
                .data("settings", {paddedTable: false, gfm: false})
                .stringify(indexMD);

                fs.writeFileSync(indexFilePath, outText);
            }
        });
    });

    
}
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:42,代码来源:gqIndex.ts


示例7: remark

import * as fs from 'fs';
import * as path from 'path';

import { graphql, buildSchema } from 'graphql';

import * as remark from 'remark';
import * as frontMatter from 'remark-frontmatter';
import { MDAST } from 'mdast';
import * as removePosInfo from 'unist-util-remove-position';

import * as MQ from './mqDefs';

let docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md');
let docSrc = fs.readFileSync(docFilePath, 'utf8');

let tree: MDAST.Root = remark()
.use(frontMatter, ["yaml"])
.parse(docSrc);

tree = removePosInfo(tree);

//console.log(JSON.stringify(tree));

let schema = buildSchema(MQ.schema);

let root = {
    document: () => new MQ.Root(tree)
};


let query = `
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:31,代码来源:remarkGraphQl.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript replaceall类代码示例发布时间:2022-05-28
下一篇:
TypeScript redux-logger类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap