v2.0.0
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 itmd.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' } })