diff options
author | 2022-07-22 22:47:21 +0000 | |
---|---|---|
committer | 2022-07-22 22:47:21 +0000 | |
commit | 41f4a8f9cbdd58e3fff7ce051bb74f058fcd3587 (patch) | |
tree | 24482c5a6d0e5f6f85b20be2ad257331565db140 /packages/markdown | |
parent | 00fab4ce135eb799cac69140403d7724686733d6 (diff) | |
download | astro-41f4a8f9cbdd58e3fff7ce051bb74f058fcd3587.tar.gz astro-41f4a8f9cbdd58e3fff7ce051bb74f058fcd3587.tar.zst astro-41f4a8f9cbdd58e3fff7ce051bb74f058fcd3587.zip |
[ci] format
Diffstat (limited to 'packages/markdown')
-rw-r--r-- | packages/markdown/remark/src/index.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/test/autolinking.test.js | 32 | ||||
-rw-r--r-- | packages/markdown/remark/test/strictness.test.js | 5 |
3 files changed, 18 insertions, 21 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index 706fc7458..8748eff2b 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -29,7 +29,7 @@ export const DEFAULT_REHYPE_PLUGINS = []; /** Shared utility for rendering markdown */ export async function renderMarkdown( content: string, - opts: MarkdownRenderingOptions, + opts: MarkdownRenderingOptions ): Promise<MarkdownRenderingResult> { let { fileURL, diff --git a/packages/markdown/remark/test/autolinking.test.js b/packages/markdown/remark/test/autolinking.test.js index 61117bddc..c5cd64657 100644 --- a/packages/markdown/remark/test/autolinking.test.js +++ b/packages/markdown/remark/test/autolinking.test.js @@ -5,26 +5,26 @@ describe('autolinking', () => { describe('plain md', () => { it('autolinks URLs starting with a protocol in plain text', async () => { const { code } = await renderMarkdown(`See https://example.com for more.`, {}); - + chai .expect(code.replace(/\n/g, '')) .to.equal(`<p>See <a href="https://example.com">https://example.com</a> for more.</p>`); }); - + it('autolinks URLs starting with "www." in plain text', async () => { const { code } = await renderMarkdown(`See www.example.com for more.`, {}); - + chai .expect(code.trim()) .to.equal(`<p>See <a href="http://www.example.com">www.example.com</a> for more.</p>`); }); - + it('does not autolink URLs in code blocks', async () => { const { code } = await renderMarkdown( 'See `https://example.com` or `www.example.com` for more.', {} ); - + chai .expect(code.trim()) .to.equal( @@ -35,14 +35,14 @@ describe('autolinking', () => { }); describe('astro-flavored md', () => { - const renderAstroMd = text => renderMarkdown(text, { isAstroFlavoredMd: true }); + const renderAstroMd = (text) => renderMarkdown(text, { isAstroFlavoredMd: true }); it('does not autolink URLs in code blocks', async () => { const { code } = await renderAstroMd( 'See `https://example.com` or `www.example.com` for more.', {} ); - + chai .expect(code.trim()) .to.equal( @@ -50,24 +50,24 @@ describe('autolinking', () => { `<code is:raw>www.example.com</code> for more.</p>` ); }); - + it('does not autolink URLs in fenced code blocks', async () => { const { code } = await renderAstroMd( 'Example:\n```\nGo to https://example.com or www.example.com now.\n```' ); - + chai .expect(code) .to.contain(`<pre is:raw`) .to.contain(`Go to https://example.com or www.example.com now.`); }); - + it('does not autolink URLs starting with a protocol when nested inside links', async () => { const { code } = await renderAstroMd( `See [http://example.com](http://example.com) or ` + `<a test href="https://example.com">https://example.com</a>` ); - + chai .expect(code.replace(/\n/g, '')) .to.equal( @@ -75,13 +75,13 @@ describe('autolinking', () => { `<a test href="https://example.com">https://example.com</a></p>` ); }); - + it('does not autolink URLs starting with "www." when nested inside links', async () => { const { code } = await renderAstroMd( `See [www.example.com](https://www.example.com) or ` + `<a test href="https://www.example.com">www.example.com</a>` ); - + chai .expect(code.replace(/\n/g, '')) .to.equal( @@ -89,13 +89,13 @@ describe('autolinking', () => { `<a test href="https://www.example.com">www.example.com</a></p>` ); }); - + it('does not autolink URLs when nested several layers deep inside links', async () => { const { code } = await renderAstroMd( `<a href="https://www.example.com">**Visit _our www.example.com or ` + `http://localhost pages_ for more!**</a>` ); - + chai .expect(code.replace(/\n/g, '')) .to.equal( @@ -104,5 +104,5 @@ describe('autolinking', () => { `</strong></a>` ); }); - }) + }); }); diff --git a/packages/markdown/remark/test/strictness.test.js b/packages/markdown/remark/test/strictness.test.js index c70872701..324415c6a 100644 --- a/packages/markdown/remark/test/strictness.test.js +++ b/packages/markdown/remark/test/strictness.test.js @@ -67,10 +67,7 @@ describe('strictness in Astro-flavored markdown', () => { }); it('should allow attribute names starting with "@" after attribute names', async () => { - const { code } = await renderAstroMd( - `<button disabled @click="handleClick">Test</button>`, - {} - ); + const { code } = await renderAstroMd(`<button disabled @click="handleClick">Test</button>`, {}); chai.expect(code.trim()).to.equal(`<button disabled @click="handleClick">Test</button>`); }); |