[ci] yarn format

This commit is contained in:
matthewp 2022-01-04 20:10:42 +00:00 committed by GitHub Actions
parent 2770588867
commit 79f8cfee60
2 changed files with 16 additions and 10 deletions

View file

@ -1,16 +1,18 @@
import { selectAll } from 'hast-util-select';
export default additions => {
const adders = Object.entries(additions).map(adder);
return node => adders.forEach(a => a(node));
export default (additions) => {
const adders = Object.entries(additions).map(adder);
return (node) => adders.forEach((a) => a(node));
};
const adder = ([selector, className]) => {
const writer = write(className);
return node => selectAll(selector, node).forEach(writer);
const writer = write(className);
return (node) => selectAll(selector, node).forEach(writer);
};
const write = className => ({ properties }) => {
if(!properties.className) properties.className = className;
else properties.className += ` ${className}`;
};
const write =
(className) =>
({ properties }) => {
if (!properties.className) properties.className = className;
else properties.className += ` ${className}`;
};

View file

@ -15,7 +15,11 @@ describe('Astro Markdown plugins', () => {
markdownRemark,
{
remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
rehypePlugins: [[import('rehype-toc'), { headings: ['h2', 'h3'] }], [import('../../../examples/with-markdown-plugins/add-classes.mjs'), { 'h1,h2,h3': 'title' }], 'rehype-slug'],
rehypePlugins: [
[import('rehype-toc'), { headings: ['h2', 'h3'] }],
[import('../../../examples/with-markdown-plugins/add-classes.mjs'), { 'h1,h2,h3': 'title' }],
'rehype-slug',
],
},
],
},