How to use the @docusaurus/utils.parse 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 panjf2000 / gnet / plugins / highlights / highlightUtils.js View on Github external
await Promise.all(highlightFiles.map(async (relativeSource) => {
        const source = path_1.default.join(highlightDir, relativeSource);
        const aliasedSource = utils_1.aliasedSitePath(source, siteDir);
        const fileString = await fs_extra_1.default.readFile(source, 'utf-8');
        const readingStats = reading_time_1.default(fileString);
        const { frontMatter, content, excerpt } = utils_1.parse(fileString);
        const fileName = path_1.default.basename(relativeSource);
        const fileNameMatch = fileName.match(FILENAME_PATTERN);
        if (frontMatter.draft && process.env.NODE_ENV === 'production') {
            return;
        }
        let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
        let description = frontMatter.description || excerpt;
        let id = frontMatter.id || frontMatter.title;
        let linkName = relativeSource.replace(/\.mdx?$/, '');
        let tags = frontMatter.tags || [];
        let title = frontMatter.title || linkName;
        highlights.push({
            id: id,
            metadata: {
                date: date,
                description: description,
github panjf2000 / gnet / plugins / highlights / highlightUtils.ts View on Github external
highlightFiles.map(async (relativeSource: string) => {
      const source = path.join(highlightDir, relativeSource);
      const aliasedSource = aliasedSitePath(source, siteDir);
      const fileString = await fs.readFile(source, 'utf-8');
      const readingStats = readingTime(fileString);
      const {frontMatter, content, excerpt} = parse(fileString);
      const fileName = path.basename(relativeSource);
      const fileNameMatch = fileName.match(FILENAME_PATTERN);

      if (frontMatter.draft && process.env.NODE_ENV === 'production') {
        return;
      }

      let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
      let description = frontMatter.description || excerpt;
      let id = frontMatter.id || frontMatter.title;
      let linkName = relativeSource.replace(/\.mdx?$/, '');
      let tags = frontMatter.tags || [];
      let title = frontMatter.title || linkName;

      highlights.push({
        id: id,

@docusaurus/utils

Node utility functions for Docusaurus packages.

MIT
Latest version published 7 days ago

Package Health Score

86 / 100
Full package analysis

Similar packages