Skip to content

Commit

Permalink
Remove support for deprecated behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 6, 2021
1 parent a7e69d1 commit 3222024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
14 changes: 0 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ const defaults = {behavior: 'prepend', content: contentDefaults}

const splice = [].splice

let deprecationWarningIssued = false

export default function attacher(options = {}) {
let {linkProperties, behavior, content, group} = {...defaults, ...options}
let method

// NOTE: Remove in next major version
if (options.behaviour !== undefined) {
if (!deprecationWarningIssued) {
deprecationWarningIssued = true
console.warn(
'[remark-autolink-headings] Deprecation Warning: `behaviour` is a nonstandard option. Use `behavior` instead.'
)
}

behavior = options.behaviour
}

if (behavior === 'wrap') {
method = wrap
} else if (behavior === 'before' || behavior === 'after') {
Expand Down
15 changes: 2 additions & 13 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ test('remarkAutolinkHeadings', (t) => {
base('output.' + b + '.html'),
'should autolink headings (' + b + ')'
)

t.is(
remark()
.use(remarkSlug)
.use(remarkHtml)
.use(remarkAutolinkHeadings, {behaviour: b})
.processSync(base('input.md'))
.toString(),
base('output.' + b + '.html'),
'should autolink headings with deprecated option (' + b + ')'
)
}

t.is(
Expand Down Expand Up @@ -98,7 +87,7 @@ test('remarkAutolinkHeadings', (t) => {
tagName: 'div',
properties: {className: ['heading-group']}
},
behaviour: 'before'
behavior: 'before'
})
.processSync('# method')
.toString(),
Expand All @@ -117,7 +106,7 @@ test('remarkAutolinkHeadings', (t) => {
properties: {className: ['heading-' + node.depth + '-group']}
}
},
behaviour: 'after'
behavior: 'after'
})
.processSync('# method')
.toString(),
Expand Down

0 comments on commit 3222024

Please sign in to comment.