0.2.1 • Published 4 years ago

mordred-transformer-markdown v0.2.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

mordred-transformer-markdown

Parse markdown files using markdown-it.

Table of Contents

Install

yarn add mordred-transformer-markdown

How to use

In your mordred.config.js:

module.exports = {
  plugins: [
    // Typically after `mordred-source-filesystem`
    {
      resolve: 'mordred-transformer-markdown',
      options: {
        // All markdown-it options are supported
      }
    }
  ]
}

How to query

A simple query:

{
  allMarkdown {
    node {
      html
      frontmatter {
        # Assumes you're using title in your frontmatter.
        title
      }
    }
  }
}

Query Markdown Headings

{
  allMarkdown {
    nodes {
      headings {
        depth
        text
      }
    }
  }
}

Pagination

By default markdown nodes are ordered by createdAt in DESC, but you can also order them by any frontmatter key:

{
  allMarkdown(orderBy: frontmatter__title, skip: 5, limit: 5) {
    nodes {
      slug
    }
    pageInfo {
      hasNextPage
      hasPrevPage
      pageCount
    }
  }
}

License

MIT © EGOIST (Kevin Titor)

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago