diff options
author | 2022-06-08 17:43:10 +0000 | |
---|---|---|
committer | 2022-06-08 17:43:10 +0000 | |
commit | c15e7ebc5e92be06a2406bed562d7c24367dc6e7 (patch) | |
tree | ca6c092acfb230a9d65f017e40f2fec7027eb915 /packages/markdown | |
parent | c549f161cadd76a666672556f2c2d63b5f97f00d (diff) | |
download | astro-c15e7ebc5e92be06a2406bed562d7c24367dc6e7.tar.gz astro-c15e7ebc5e92be06a2406bed562d7c24367dc6e7.tar.zst astro-c15e7ebc5e92be06a2406bed562d7c24367dc6e7.zip |
[ci] format
Diffstat (limited to 'packages/markdown')
-rw-r--r-- | packages/markdown/remark/src/mdxjs.ts | 14 | ||||
-rw-r--r-- | packages/markdown/remark/src/remark-mdxish.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/test/strictness.test.js | 75 |
3 files changed, 23 insertions, 68 deletions
diff --git a/packages/markdown/remark/src/mdxjs.ts b/packages/markdown/remark/src/mdxjs.ts index b00c3eb80..c3a9849ea 100644 --- a/packages/markdown/remark/src/mdxjs.ts +++ b/packages/markdown/remark/src/mdxjs.ts @@ -4,13 +4,13 @@ // See `@astrojs/micromark-extension-mdx-jsx` on NPM for more details. // Also, support for ESM imports & exports in Markdown content was removed. +import { mdxJsx } from '@astrojs/micromark-extension-mdx-jsx'; import { Parser } from 'acorn'; import acornJsx from 'acorn-jsx'; -import { combineExtensions } from 'micromark-util-combine-extensions'; +import type { Options } from 'micromark-extension-mdx-expression'; import { mdxExpression } from 'micromark-extension-mdx-expression'; -import { mdxJsx } from '@astrojs/micromark-extension-mdx-jsx'; import { mdxMd } from 'micromark-extension-mdx-md'; -import type { Options } from 'micromark-extension-mdx-expression'; +import { combineExtensions } from 'micromark-util-combine-extensions'; import type { Extension } from 'micromark-util-types'; export function mdxjs(options: Options): Extension { @@ -18,14 +18,10 @@ export function mdxjs(options: Options): Extension { { acorn: Parser.extend(acornJsx()), acornOptions: { ecmaVersion: 2020, sourceType: 'module' }, - addResult: true + addResult: true, }, options ); - return combineExtensions([ - mdxExpression(settings), - mdxJsx(settings), - mdxMd - ]); + return combineExtensions([mdxExpression(settings), mdxJsx(settings), mdxMd]); } diff --git a/packages/markdown/remark/src/remark-mdxish.ts b/packages/markdown/remark/src/remark-mdxish.ts index 7911f5ec9..50bf5f103 100644 --- a/packages/markdown/remark/src/remark-mdxish.ts +++ b/packages/markdown/remark/src/remark-mdxish.ts @@ -1,7 +1,7 @@ import type * as fromMarkdown from 'mdast-util-from-markdown'; import type { Tag } from 'mdast-util-mdx-jsx'; -import { mdxjs } from './mdxjs.js'; import { mdxFromMarkdown, mdxToMarkdown } from './mdast-util-mdxish.js'; +import { mdxjs } from './mdxjs.js'; export default function remarkMdxish(this: any, options = {}) { const data = this.data(); diff --git a/packages/markdown/remark/test/strictness.test.js b/packages/markdown/remark/test/strictness.test.js index 178d48f74..5ba9c215a 100644 --- a/packages/markdown/remark/test/strictness.test.js +++ b/packages/markdown/remark/test/strictness.test.js @@ -17,36 +17,21 @@ describe('strictness', () => { }); it('should allow attribute names starting with ":" after element names', async () => { - const { code } = await renderMarkdown( - `<div :class="open ? '' : 'hidden'">Test</div>`, - {} - ); + const { code } = await renderMarkdown(`<div :class="open ? '' : 'hidden'">Test</div>`, {}); - chai - .expect(code.trim()) - .to.equal(`<div :class="open ? '' : 'hidden'">Test</div>`); + chai.expect(code.trim()).to.equal(`<div :class="open ? '' : 'hidden'">Test</div>`); }); it('should allow attribute names starting with ":" after local element names', async () => { - const { code } = await renderMarkdown( - `<div.abc :class="open ? '' : 'hidden'">x</div.abc>`, - {} - ); + const { code } = await renderMarkdown(`<div.abc :class="open ? '' : 'hidden'">x</div.abc>`, {}); - chai - .expect(code.trim()) - .to.equal(`<div.abc :class="open ? '' : 'hidden'">x</div.abc>`); + chai.expect(code.trim()).to.equal(`<div.abc :class="open ? '' : 'hidden'">x</div.abc>`); }); it('should allow attribute names starting with ":" after attribute names', async () => { - const { code } = await renderMarkdown( - `<input type="text" disabled :placeholder="hi">`, - {} - ); + const { code } = await renderMarkdown(`<input type="text" disabled :placeholder="hi">`, {}); - chai - .expect(code.trim()) - .to.equal(`<input type="text" disabled :placeholder="hi" />`); + chai.expect(code.trim()).to.equal(`<input type="text" disabled :placeholder="hi" />`); }); it('should allow attribute names starting with ":" after local attribute names', async () => { @@ -55,31 +40,19 @@ describe('strictness', () => { {} ); - chai - .expect(code.trim()) - .to.equal(`<input type="text" x-test:disabled :placeholder="hi" />`); + chai.expect(code.trim()).to.equal(`<input type="text" x-test:disabled :placeholder="hi" />`); }); it('should allow attribute names starting with ":" after attribute values', async () => { - const { code } = await renderMarkdown( - `<input type="text" :placeholder="placeholder">`, - {} - ); + const { code } = await renderMarkdown(`<input type="text" :placeholder="placeholder">`, {}); - chai - .expect(code.trim()) - .to.equal(`<input type="text" :placeholder="placeholder" />`); + chai.expect(code.trim()).to.equal(`<input type="text" :placeholder="placeholder" />`); }); it('should allow attribute names starting with "@" after element names', async () => { - const { code } = await renderMarkdown( - `<button @click="handleClick">Test</button>`, - {} - ); + const { code } = await renderMarkdown(`<button @click="handleClick">Test</button>`, {}); - chai - .expect(code.trim()) - .to.equal(`<button @click="handleClick">Test</button>`); + chai.expect(code.trim()).to.equal(`<button @click="handleClick">Test</button>`); }); it('should allow attribute names starting with "@" after local element names', async () => { @@ -88,9 +61,7 @@ describe('strictness', () => { {} ); - chai - .expect(code.trim()) - .to.equal(`<button.local @click="handleClick">Test</button.local>`); + chai.expect(code.trim()).to.equal(`<button.local @click="handleClick">Test</button.local>`); }); it('should allow attribute names starting with "@" after attribute names', async () => { @@ -99,9 +70,7 @@ describe('strictness', () => { {} ); - chai - .expect(code.trim()) - .to.equal(`<button disabled @click="handleClick">Test</button>`); + chai.expect(code.trim()).to.equal(`<button disabled @click="handleClick">Test</button>`); }); it('should allow attribute names starting with "@" after local attribute names', async () => { @@ -110,9 +79,7 @@ describe('strictness', () => { {} ); - chai - .expect(code.trim()) - .to.equal(`<button x-test:disabled @click="handleClick">Test</button>`); + chai.expect(code.trim()).to.equal(`<button x-test:disabled @click="handleClick">Test</button>`); }); it('should allow attribute names starting with "@" after attribute values', async () => { @@ -121,20 +88,12 @@ describe('strictness', () => { {} ); - chai - .expect(code.trim()) - .to.equal(`<button type="submit" @click="handleClick">Test</button>`); + chai.expect(code.trim()).to.equal(`<button type="submit" @click="handleClick">Test</button>`); }); it('should allow attribute names containing dots', async () => { - const { code } = await renderMarkdown( - `<input x-on:input.debounce.500ms="fetchResults">`, - {} - ); + const { code } = await renderMarkdown(`<input x-on:input.debounce.500ms="fetchResults">`, {}); - chai - .expect(code.trim()) - .to.equal(`<input x-on:input.debounce.500ms="fetchResults" />`); + chai.expect(code.trim()).to.equal(`<input x-on:input.debounce.500ms="fetchResults" />`); }); - }); |