Parse markdown files using markdown-it.
yarn add mordred-transformer-markdown
In your mordred.config.js
:
module.exports = {
plugins: [
// Typically after `mordred-source-filesystem`
{
resolve: 'mordred-transformer-markdown',
options: {
// All markdown-it options are supported
}
}
]
}
A simple query:
{
allMarkdown {
node {
html
frontmatter {
# Assumes you're using title in your frontmatter.
title
}
}
}
}
{
allMarkdown {
nodes {
headings {
depth
text
}
}
}
}
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
}
}
}
MIT © EGOIST (Kevin Titor)