How to use the @docusaurus/utils.parseMarkdownString function in @docusaurus/utils

To help you get started, we’ve selected a few @docusaurus/utils 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 Jeffail / benthos / website / src / plugins / cookbooks / cookbookUtils.js View on Github external
guideFiles.map(async (relativeSource) => {
      const source = path.join(guideDir, relativeSource);
      const aliasedSource = aliasedSitePath(source, siteDir);
      const guideFileName = path.basename(relativeSource);

      const fileString = await fs.readFile(source, 'utf-8');
      const {frontMatter, excerpt} = parseMarkdownString(fileString);

      let date;
      // Extract date and title from filename.
      const match = guideFileName.match(FILENAME_PATTERN);
      let linkName = guideFileName.replace(/\.mdx?$/, '');
      if (match) {
        const [, dateString, name] = match;
        date = new Date(dateString);
        linkName = name;
      }
      // Prefer user-defined date.
      if (frontMatter.date) {
        date = new Date(frontMatter.date);
      }
      // Use file create time for guide.
      date = date || (await fs.stat(source)).birthtime;
github Jeffail / benthos / website / src / plugins / components / index.js View on Github external
fs.readdirSync(dir).forEach(function (file) {
    if ( !/about\.mdx?/.test(file) ) {
      let name = file.split('.').slice(0, -1).join('.');
      let data = fs.readFileSync(path.join(dir, file));
      const {frontMatter} = parseMarkdownString(data);
      frontMatter["name"] = name;
      components.push(frontMatter);
    }
  });
  return components;

@docusaurus/utils

Node utility functions for Docusaurus packages.

MIT
Latest version published 30 days ago

Package Health Score

92 / 100
Full package analysis

Similar packages