mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
[ci] yarn format
This commit is contained in:
parent
2770588867
commit
79f8cfee60
2 changed files with 16 additions and 10 deletions
|
@ -1,16 +1,18 @@
|
||||||
import { selectAll } from 'hast-util-select';
|
import { selectAll } from 'hast-util-select';
|
||||||
|
|
||||||
export default additions => {
|
export default (additions) => {
|
||||||
const adders = Object.entries(additions).map(adder);
|
const adders = Object.entries(additions).map(adder);
|
||||||
return node => adders.forEach(a => a(node));
|
return (node) => adders.forEach((a) => a(node));
|
||||||
};
|
};
|
||||||
|
|
||||||
const adder = ([selector, className]) => {
|
const adder = ([selector, className]) => {
|
||||||
const writer = write(className);
|
const writer = write(className);
|
||||||
return node => selectAll(selector, node).forEach(writer);
|
return (node) => selectAll(selector, node).forEach(writer);
|
||||||
};
|
};
|
||||||
|
|
||||||
const write = className => ({ properties }) => {
|
const write =
|
||||||
if(!properties.className) properties.className = className;
|
(className) =>
|
||||||
else properties.className += ` ${className}`;
|
({ properties }) => {
|
||||||
};
|
if (!properties.className) properties.className = className;
|
||||||
|
else properties.className += ` ${className}`;
|
||||||
|
};
|
||||||
|
|
|
@ -15,7 +15,11 @@ describe('Astro Markdown plugins', () => {
|
||||||
markdownRemark,
|
markdownRemark,
|
||||||
{
|
{
|
||||||
remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
|
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',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue