[ci] format

This commit is contained in:
matthewp 2022-08-25 21:24:13 +00:00 committed by fredkbot
parent ac03218247
commit 4faee5afed
2 changed files with 12 additions and 11 deletions

View file

@ -650,7 +650,7 @@ export interface AstroUserConfig {
* @description
* Pass [remark plugins](https://github.com/remarkjs/remark) to customize how your Markdown is built. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
*
* :::caution
* :::caution
* Providing a list of plugins will **remove** our default plugins. To preserve these defaults, see the `extendDefaultPlugins` flag.
* :::
*
@ -671,7 +671,7 @@ export interface AstroUserConfig {
* @description
* Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
*
* :::caution
* :::caution
* Providing a list of plugins will **remove** our default plugins. To preserve these defaults, see the `extendDefaultPlugins` flag.
* :::
*

View file

@ -14,8 +14,11 @@ async function buildFixture(config) {
function remarkExamplePlugin() {
return (tree) => {
tree.children.push({ type: 'paragraph', children: [{ type: 'text', value: 'Remark plugin applied!' }] })
}
tree.children.push({
type: 'paragraph',
children: [{ type: 'text', value: 'Remark plugin applied!' }],
});
};
}
describe('Astro Markdown plugins', () => {
@ -48,28 +51,26 @@ describe('Astro Markdown plugins', () => {
const fixture = await buildFixture({
markdown: {
remarkPlugins: [remarkExamplePlugin],
rehypePlugins: [
[addClasses, { 'h1,h2,h3': 'title' }],
],
rehypePlugins: [[addClasses, { 'h1,h2,h3': 'title' }]],
extendDefaultPlugins,
},
});
const html = await fixture.readFile('/with-gfm/index.html');
const $ = cheerio.load(html);
// test 1: GFM autolink applied correctly
if (extendDefaultPlugins === true) {
expect($('a[href="https://example.com"]')).to.have.lengthOf(1);
} else {
expect($('a[href="https://example.com"]')).to.have.lengthOf(0);
}
// test 2: (sanity check) remark plugins still applied
expect(html).to.include('Remark plugin applied!');
// test 3: (sanity check) rehype plugins still applied
expect($('#github-flavored-markdown-test')).to.have.lengthOf(1);
expect($('#github-flavored-markdown-test').hasClass('title')).to.equal(true);
})
});
}
});