Skip to content

Releases: crookedneighbor/markdown-it-link-attributes

v3.0.0

07 Oct 15:01
Compare
Choose a tag to compare

Breaking Changes from v2.1.0

Drop Support for Markdown-it v8 and lower

New Features

Built version of file is available on npm in the /dist directory

v2.1.0

03 Apr 13:24
Compare
Choose a tag to compare
  • Support strings for pattern option (#18)

v2.0.0

21 Sep 16:34
Compare
Choose a tag to compare

Breaking Changes from v1.0.0

  • Attributes are now nested under an attrs property.
    v1.0.0:

     md.use(mila, {
       target: '_blank',
       rel: 'noopener'
     })

    v2.0.0:

     md.use(mila, {
       attrs: {
         target: '_blank',
         rel: 'noopener'
      }
    })

    This allows us to support things like pattern

New features

  • Add pattern property to specify a regex to apply config to links conditionally if the href of the link matches it

    md.use(mila, {
      pattern: /^https?:\/\//,
      attrs: {
        target: '_blank',
        rel: 'noopener'
      }
    })
  • Add an array of configs for multiple config options, the first pattern to match will use that config

    md.use(mila, [{
      pattern: /^https?:\/\//, // apply target and rel properties for external links
      attrs: {
        target: '_blank',
        rel: 'noopener'
      }, {
      attrs: { // otherwise, apply a class to internal links
        className: 'internal-link'
      }
    })