Skip to content

Commit

Permalink
Better options for allPlugins (#18)
Browse files Browse the repository at this point in the history
* allow options to be passed directly into include-markdown from the allPlugins export
* add test
* update dependencies
* toBe -> toEqual
  • Loading branch information
jescalan authored Jul 28, 2020
1 parent 6deb1e7 commit f456139
Show file tree
Hide file tree
Showing 5 changed files with 4,566 additions and 3,203 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ module.exports = {
anchorLinks,
paragraphCustomAlerts,
typography,
includeMarkdown
includeMarkdown,
}

// for easy use of everything at the same time
module.exports.allPlugins = ({ anchorLinks: anchorLinksOptions } = {}) => [
includeMarkdown,
module.exports.allPlugins = ({
anchorLinks: anchorLinksOptions,
includeMarkdown: includeMarkdownOptions,
} = {}) => [
[includeMarkdown, includeMarkdownOptions],
[anchorLinks, anchorLinksOptions],
paragraphCustomAlerts,
typography
typography,
]
3 changes: 2 additions & 1 deletion index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ it('api works as intended', () => {
expect(remarkPlugins.typography).toBeTruthy()
expect(remarkPlugins.includeMarkdown).toBeTruthy()
expect(remarkPlugins.allPlugins().length).toBe(4)
// passes options to anchorLinks correctly
// passes options correctly
expect(remarkPlugins.allPlugins({ anchorLinks: 'foo' })[1][1]).toBe('foo')
expect(remarkPlugins.allPlugins({ includeMarkdown: 'bar' })[0][1]).toBe('bar')
})
Loading

0 comments on commit f456139

Please sign in to comment.