Markdown transformer for Gridsome
> Markdown transformer for Gridsome with Remark.
- yarn add @gridsome/transformer-remark
- npm install @gridsome/transformer-remark
The transformer is automatically used if installed in your project. Custom transformer options can either be set for each source plugin or globally.
``js`
//gridsome.config.js
module.exports = {
plugins: [
{
use: '@gridsome/source-filesystem',
options: {
path: 'blog/*/.md',
typeName: 'Post',
remark: {
// remark options
}
}
}
],
transformers: {
remark: {
// global remark options
}
}
}
By default this plugin comes with remark-slug, remark-autolink-headings, remark-external-links, remark-squeeze-paragraphs and remark-fix-guillemets included. Add any additional Remark plugin with a plugins option. Included plugins can also be disabled if needed. See more info below.
The following example adds the remark-attr plugin globally if it is installed in your project.
`js`
{
remark: {
plugins: [
'remark-attr'
]
}
}
#### plugins
- Type: Array[]
- Default:
Add additional Remark plugins.
`js`
{
remark: {
plugins: [
// add plugin without options
'remark-plugin',
// require plugin manually
require('remark-plugin'),
// add plugin with options
['remark-plugin', { / plugin options / }]
]
}
}
#### useBuiltIns
- Type: booleantrue
- Default:
Set this option to false to disable all built-in plugins.
#### grayMatter
- Type: object {}
- Default:
Options to pass through to [gray-matter][] for parsing front matter.
[gray-matter]: https://github.com/jonschlinkert/gray-matter#options
#### squeezeParagraphs
- Type: booleantrue
- Default:
Remove empty (or white-space only) paragraphs.
#### externalLinks
- Type: booleantrue
- Default:
Add target and rel attributes to external links.
#### externalLinksTarget
- Type: string'_blank'
- Default:
#### externalLinksRel
- Type: Array | string['nofollow', 'noopener', 'noreferrer']
- Default:
#### slug
- Type: booleantrue
- Default:
Add anchors to heading.
#### autolinkHeadings
- Type: booleantrue
- Default:
Automatically add links to headings. Disabled if slug is false.
#### autolinkClassName
- Type: string'icon icon-link'
- Default:
#### fixGuillemets
- Type: booleantrue
- Default:
Support ASCII guillemets (<<, >>) and mapping them to HTML.
#### imageQuality
- Type: number75
- Default:
#### imageBlurRatio
- Type: number40
- Default:
#### imageBackground
- Type: string
#### lazyLoadImages
- Type: booleantrue
- Default:
#### config
- Type: Object{}
- Default:
Add additional Remark options.
This allows you to enable/disable gfm, commonmark, footnotes, pedantic and blocks.
* gfm
* Type: booleantrue
* Default:
* commonmark
* Type: booleanfalse
* Default: boolean
* footnotes
* Type: false
* Default: boolean
* pedantic
* Type: false
* Default: Array | string
* blocks
* Type:
* Default: list of block HTML elements
`js``
{
remark: {
plugins: [
//...
],
config: {
footnotes: true
}
}
}