How to use turpan - 3 common examples

To help you get started, we’ve selected a few turpan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ruanyf / loppo / bin / count.js View on Github external
.forEach((c) => {
        const fileName = Object.keys(c)[0];
        const filePath = path.resolve(process.cwd(), docDir, fileName);
        let fileContent = fs.readFileSync(filePath, 'utf8').trim();
        const fileContentArr = fileContent.split('\n');
        if (/^\s*#\s*([^#].*?)\s*$/.test(fileContentArr[0])) fileContentArr.shift();
        fileContent = fileContentArr.join('\n');

        const HTMLContent = md.render(fileContent);
        const TEXTContent = htmlToText.fromString(HTMLContent, {
          wordwrap: false,
          ignoreImage: true,
          ignoreHref: true
        });
        const result = {};
        result.file = fileName;
        result.line = TEXTContent.split('\n').length;
        result.word = wordCount(TEXTContent);
        result.char = TEXTContent.length;
        filesArr.push(result);
      });
github ruanyf / loppo / lib / utils.js View on Github external
function markdownRender(root, optionObj) {
  md.set({
    tocCallback(tocMarkdown, tocArray, tocHtml) {
      optionObj.toc = tocHtml;
    }
  });

  optionObj.content = md.render(optionObj.content);
  return optionObj;
}
github ruanyf / loppo / lib / utils.js View on Github external
function markdownRender(root, optionObj) {
  md.set({
    tocCallback(tocMarkdown, tocArray, tocHtml) {
      optionObj.toc = tocHtml;
    }
  });

  optionObj.content = md.render(optionObj.content);
  return optionObj;
}

turpan

a wrapped markdown render based on Markdown-it

MIT
Latest version published 5 months ago

Package Health Score

50 / 100
Full package analysis

Popular turpan functions