@astrojs/markdown-remark 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/remark-shiki.js +17 -0
- package/package.json +7 -4
- package/.turbo/turbo-build.log +0 -5
- package/CHANGELOG.md +0 -821
- package/src/frontmatter-injection.ts +0 -41
- package/src/index.ts +0 -170
- package/src/internal.ts +0 -5
- package/src/load-plugins.ts +0 -42
- package/src/rehype-collect-headings.ts +0 -129
- package/src/rehype-images.ts +0 -19
- package/src/remark-collect-images.ts +0 -30
- package/src/remark-prism.ts +0 -32
- package/src/remark-scoped-styles.ts +0 -18
- package/src/remark-shiki.ts +0 -106
- package/src/types.ts +0 -96
- package/test/autolinking.test.js +0 -43
- package/test/entities.test.js +0 -14
- package/test/plugins.test.js +0 -28
- package/test/test-utils.js +0 -3
- package/tsconfig.json +0 -10
package/test/autolinking.test.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { renderMarkdown } from '../dist/index.js';
|
|
2
|
-
import chai from 'chai';
|
|
3
|
-
import { mockRenderMarkdownParams } from './test-utils.js';
|
|
4
|
-
|
|
5
|
-
describe('autolinking', () => {
|
|
6
|
-
describe('plain md', () => {
|
|
7
|
-
it('autolinks URLs starting with a protocol in plain text', async () => {
|
|
8
|
-
const { code } = await renderMarkdown(
|
|
9
|
-
`See https://example.com for more.`,
|
|
10
|
-
mockRenderMarkdownParams
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
chai
|
|
14
|
-
.expect(code.replace(/\n/g, ''))
|
|
15
|
-
.to.equal(`<p>See <a href="https://example.com">https://example.com</a> for more.</p>`);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('autolinks URLs starting with "www." in plain text', async () => {
|
|
19
|
-
const { code } = await renderMarkdown(
|
|
20
|
-
`See www.example.com for more.`,
|
|
21
|
-
mockRenderMarkdownParams
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
chai
|
|
25
|
-
.expect(code.trim())
|
|
26
|
-
.to.equal(`<p>See <a href="http://www.example.com">www.example.com</a> for more.</p>`);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('does not autolink URLs in code blocks', async () => {
|
|
30
|
-
const { code } = await renderMarkdown(
|
|
31
|
-
'See `https://example.com` or `www.example.com` for more.',
|
|
32
|
-
mockRenderMarkdownParams
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
chai
|
|
36
|
-
.expect(code.trim())
|
|
37
|
-
.to.equal(
|
|
38
|
-
`<p>See <code>https://example.com</code> or ` +
|
|
39
|
-
`<code>www.example.com</code> for more.</p>`
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
package/test/entities.test.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { renderMarkdown } from '../dist/index.js';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { mockRenderMarkdownParams } from './test-utils.js';
|
|
4
|
-
|
|
5
|
-
describe('entities', () => {
|
|
6
|
-
it('should not unescape entities in regular Markdown', async () => {
|
|
7
|
-
const { code } = await renderMarkdown(
|
|
8
|
-
`<i>This should NOT be italic</i>`,
|
|
9
|
-
mockRenderMarkdownParams
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
expect(code).to.equal(`<p><i>This should NOT be italic</i></p>`);
|
|
13
|
-
});
|
|
14
|
-
});
|
package/test/plugins.test.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { renderMarkdown } from '../dist/index.js';
|
|
2
|
-
import { mockRenderMarkdownParams } from './test-utils.js';
|
|
3
|
-
import chai from 'chai';
|
|
4
|
-
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
describe('plugins', () => {
|
|
8
|
-
// https://github.com/withastro/astro/issues/3264
|
|
9
|
-
it('should be able to get file path when passing fileURL', async () => {
|
|
10
|
-
let context;
|
|
11
|
-
await renderMarkdown(`test`, {
|
|
12
|
-
...mockRenderMarkdownParams,
|
|
13
|
-
fileURL: new URL('virtual.md', import.meta.url),
|
|
14
|
-
remarkPlugins: [
|
|
15
|
-
function () {
|
|
16
|
-
const transformer = (tree, file) => {
|
|
17
|
-
context = file;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return transformer;
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
chai.expect(typeof context).to.equal('object');
|
|
26
|
-
chai.expect(context.path).to.equal(fileURLToPath(new URL('virtual.md', import.meta.url)));
|
|
27
|
-
});
|
|
28
|
-
});
|
package/test/test-utils.js
DELETED