Détail du package

@gridsome/transformer-remark

gridsome6k0.6.4

Markdown transformer for Gridsome

gridsome, gridsome-plugin, gridsome-transformer, markdown

readme

@gridsome/transformer-remark

Markdown transformer for Gridsome with Remark.

Install

  • yarn add @gridsome/transformer-remark
  • npm install @gridsome/transformer-remark

Basic usage

The transformer is automatically used if installed in your project. Custom transformer options can either be set for each source plugin or globally.

//gridsome.config.js
module.exports = {
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: 'blog/**/*.md',
        typeName: 'Post',
        remark: {
          // remark options
        }
      }
    }
  ],
  transformers: {
    remark: {
      // global remark options
    }
  }
}

Add additional plugins

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.

{
  remark: {
    plugins: [
      'remark-attr'
    ]
  }
}

Options

plugins

  • Type: Array
  • Default: []

Add additional Remark plugins.

{
  remark: {
    plugins: [
      // add plugin without options
      'remark-plugin',
      // require plugin manually
      require('remark-plugin'),
      // add plugin with options
      ['remark-plugin', { /* plugin options */ }]
    ]
  }
}

useBuiltIns

  • Type: boolean
  • Default: true

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.

squeezeParagraphs

  • Type: boolean
  • Default: true

Remove empty (or white-space only) paragraphs.

externalLinks

  • Type: boolean
  • Default: true

Add target and rel attributes to external links.

externalLinksTarget

  • Type: string
  • Default: '_blank'

externalLinksRel

  • Type: Array | string
  • Default: ['nofollow', 'noopener', 'noreferrer']

slug

  • Type: boolean
  • Default: true

Add anchors to heading.

autolinkHeadings

  • Type: boolean
  • Default: true

Automatically add links to headings. Disabled if slug is false.

autolinkClassName

  • Type: string
  • Default: 'icon icon-link'

fixGuillemets

  • Type: boolean
  • Default: true

Support ASCII guillemets (<<, >>) and mapping them to HTML.

imageQuality

  • Type: number
  • Default: 75

imageBlurRatio

  • Type: number
  • Default: 40

imageBackground

  • Type: string

lazyLoadImages

  • Type: boolean
  • Default: true

config

  • Type: Object
  • Default: {}

Add additional Remark options.

This allows you to enable/disable gfm, commonmark, footnotes, pedantic and blocks.

  • gfm

    • Type: boolean
    • Default: true
  • commonmark

    • Type: boolean
    • Default: false
  • footnotes

    • Type: boolean
    • Default: false
  • pedantic

    • Type: boolean
    • Default: false
  • blocks

{
  remark: {
    plugins: [
      //...
    ],
    config: {
      footnotes: true
    }
  }
}

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.6.4 (2020-11-22)

Note: Version bump only for package @gridsome/transformer-remark

0.6.3 (2020-09-18)

Note: Version bump only for package @gridsome/transformer-remark

0.6.2 (2020-08-25)

Note: Version bump only for package @gridsome/transformer-remark

0.6.1 (2020-07-02)

Note: Version bump only for package @gridsome/transformer-remark

0.6.0 (2020-05-26)

Features

0.5.0 (2020-02-18)

Features

0.4.0 (2019-10-25)

Features

  • remark: set custom grayMatter options (#284) (23a5d82)

0.3.4 (2019-09-20)

Bug Fixes

0.3.3 (2019-09-11)

Bug Fixes

  • remark: basic gridsome v0.7 support (424140d)
  • remark: more options for disabling plugins (4224568)

0.3.2 (2019-05-20)

Note: Version bump only for package @gridsome/transformer-remark

0.3.1 (2019-05-13)

Bug Fixes

  • remark: let plugins set custom stringifier (f2d3acc)

0.3.0 (2019-05-10)

Bug Fixes

  • remark: support all remark plugins (#18) (9b4ea5b)

Features

  • update for latests changes in core (8abcbf4)

0.2.1 (2019-02-26)

Note: Version bump only for package @gridsome/transformer-remark

0.2.0 (2019-02-19)

Bug Fixes

  • remark: improve time to read calculation (48bf600)
  • remark: resolve image urls like front matter paths (db7dde1)

Features

  • remark: option for disabling all built-in plugins (6336590)
  • remark: optionally disable built-in plugins (fc1e2c2)
  • remark: resolve local file links in content (3ffc066)
  • remark: simple api for other pugins (760d1bc)

0.1.3 (2019-01-04)

Bug Fixes

  • remark: calculate time to read correctly (4d5801d)

0.1.2 (2018-12-06)

Bug Fixes

  • remark: get heading anchors (5806569)
  • remark: override autolink heading options (21ba048)
  • remark: strip html tags from headings (c6da951)

0.1.1 (2018-11-11)

Bug Fixes

  • use local remark options (2be21e5)

0.1.0 (2018-10-30)

Bug Fixes

  • transformer-remark: dont process relative image urls (7d4edf3)
  • transformer-remark: support any remark plugin (d9ff803)
  • transformer-remark: title fallback (d0a83b5)

Features

  • transformer-remark: process absolute image paths (d558cf0)

0.0.3 (2018-09-26)

Bug Fixes

  • remark: add aria-hidden to heading links (45a276f)
  • remark: noscript fallback image (34ad69d)

0.0.2 (2018-09-16)