Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a way to configure remark options. #8014

Merged
merged 3 commits into from Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/using-remark/gatsby-config.js
Expand Up @@ -26,6 +26,11 @@ module.exports = {
{
resolve: `gatsby-transformer-remark`,
options: {
gfm: true,
commonmark: true,
footnotes: true,
pedantic: true,
// blocks: ["h2"], Blocks option value can be provided here as an array.
excerpt_separator: `<!-- end -->`,
plugins: [
{
Expand Down
16 changes: 11 additions & 5 deletions packages/gatsby-transformer-remark/src/extend-node-type.js
Expand Up @@ -74,11 +74,17 @@ module.exports = (

return new Promise((resolve, reject) => {
// Setup Remark.
let remark = new Remark().data(`settings`, {
commonmark: true,
footnotes: true,
pedantic: true,
})
const { commonmark = true, footnotes = true, pedantic = true, gfm = true, blocks } = pluginOptions
const remarkOptions = {
gfm,
commonmark,
footnotes,
pedantic,
}
if (_.isArray(blocks)) {
remarkOptions.blocks = blocks
}
let remark = new Remark().data(`settings`, remarkOptions)

for (let plugin of pluginOptions.plugins) {
const requiredPlugin = require(plugin.resolve)
Expand Down