@astrojs/mdx 0.18.0 → 0.18.2
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +4 -14
- package/dist/index.js +7 -7
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +8 -0
- package/dist/rehype-collect-headings.d.ts +1 -1
- package/package.json +7 -5
- package/src/index.ts +12 -24
- package/src/plugins.ts +1 -1
- package/src/rehype-collect-headings.ts +1 -1
- package/test/fixtures/mdx-math/src/pages/mathjax.mdx +5 -0
- package/test/fixtures/mdx-script-style-raw/src/pages/index.mdx +13 -0
- package/test/mdx-math.test.js +64 -0
- package/test/mdx-script-style-raw.test.js +70 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[34m@astrojs/mdx:build: [0mcache hit, replaying output [2m83b53c3b3706ec68[0m
|
|
2
|
+
[34m@astrojs/mdx:build: [0m
|
|
3
|
+
[34m@astrojs/mdx:build: [0m> @astrojs/mdx@0.18.2 build /home/runner/work/astro/astro/packages/integrations/mdx
|
|
4
|
+
[34m@astrojs/mdx:build: [0m> astro-scripts build "src/**/*.ts" && tsc
|
|
5
|
+
[34m@astrojs/mdx:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @astrojs/mdx
|
|
2
2
|
|
|
3
|
+
## 0.18.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6552](https://github.com/withastro/astro/pull/6552) [`392ba3e4d`](https://github.com/withastro/astro/commit/392ba3e4d55f73ce9194bd94a2243f1aa62af079) Thanks [@bluwy](https://github.com/bluwy)! - Fix integration return type
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`90e5f87d0`](https://github.com/withastro/astro/commit/90e5f87d03215a833bb6ac91f9548670a25ce659), [`f5fddafc2`](https://github.com/withastro/astro/commit/f5fddafc248bb1ef57b7349bfecc25539ae2b5ea)]:
|
|
10
|
+
- @astrojs/markdown-remark@2.1.1
|
|
11
|
+
|
|
12
|
+
## 0.18.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#6494](https://github.com/withastro/astro/pull/6494) [`a13e9d7e3`](https://github.com/withastro/astro/commit/a13e9d7e33baccf51e7d4815f99b481ad174bc57) Thanks [@Yan-Thomas](https://github.com/Yan-Thomas)! - Consistency improvements to several package descriptions
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`a13e9d7e3`](https://github.com/withastro/astro/commit/a13e9d7e33baccf51e7d4815f99b481ad174bc57)]:
|
|
19
|
+
- @astrojs/prism@2.1.1
|
|
20
|
+
|
|
3
21
|
## 0.18.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
|
2
|
-
import { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
3
|
-
import type { AstroIntegration
|
|
2
|
+
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
3
|
+
import type { AstroIntegration } from 'astro';
|
|
4
4
|
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
|
5
|
-
export
|
|
5
|
+
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
|
|
6
6
|
extendMarkdownConfig: boolean;
|
|
7
7
|
recmaPlugins: PluggableList;
|
|
8
8
|
remarkPlugins: PluggableList;
|
|
9
9
|
rehypePlugins: PluggableList;
|
|
10
10
|
remarkRehype: RemarkRehypeOptions;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
name: string;
|
|
14
|
-
hooks: Omit<AstroIntegration['hooks'], 'astro:config:setup'> & {
|
|
15
|
-
'astro:config:setup': (params: HookParameters<'astro:config:setup'> & {
|
|
16
|
-
addPageExtension: (extension: string) => void;
|
|
17
|
-
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
18
|
-
}) => void | Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export default function mdx(partialMdxOptions?: Partial<MdxOptions>): IntegrationWithPrivateHooks;
|
|
22
|
-
export {};
|
|
12
|
+
export default function mdx(partialMdxOptions?: Partial<MdxOptions>): AstroIntegration;
|
package/dist/index.js
CHANGED
|
@@ -12,13 +12,8 @@ function mdx(partialMdxOptions = {}) {
|
|
|
12
12
|
return {
|
|
13
13
|
name: "@astrojs/mdx",
|
|
14
14
|
hooks: {
|
|
15
|
-
"astro:config:setup": async ({
|
|
16
|
-
updateConfig,
|
|
17
|
-
config,
|
|
18
|
-
addPageExtension,
|
|
19
|
-
addContentEntryType,
|
|
20
|
-
command
|
|
21
|
-
}) => {
|
|
15
|
+
"astro:config:setup": async (params) => {
|
|
16
|
+
const { updateConfig, config, addPageExtension, addContentEntryType, command } = params;
|
|
22
17
|
addPageExtension(".mdx");
|
|
23
18
|
addContentEntryType({
|
|
24
19
|
extensions: [".mdx"],
|
|
@@ -50,6 +45,7 @@ function mdx(partialMdxOptions = {}) {
|
|
|
50
45
|
remarkRehypeOptions: mdxOptions.remarkRehype,
|
|
51
46
|
jsx: true,
|
|
52
47
|
jsxImportSource: "astro",
|
|
48
|
+
// Note: disable `.md` (and other alternative extensions for markdown files like `.markdown`) support
|
|
53
49
|
format: "mdx",
|
|
54
50
|
mdExtensions: []
|
|
55
51
|
};
|
|
@@ -65,6 +61,8 @@ function mdx(partialMdxOptions = {}) {
|
|
|
65
61
|
configResolved(resolved) {
|
|
66
62
|
importMetaEnv = { ...importMetaEnv, ...resolved.env };
|
|
67
63
|
},
|
|
64
|
+
// Override transform to alter code before MDX compilation
|
|
65
|
+
// ex. inject layouts
|
|
68
66
|
async transform(_, id) {
|
|
69
67
|
if (!id.endsWith("mdx"))
|
|
70
68
|
return;
|
|
@@ -75,6 +73,7 @@ function mdx(partialMdxOptions = {}) {
|
|
|
75
73
|
...mdxPluginOpts,
|
|
76
74
|
elementAttributeNameCase: "html",
|
|
77
75
|
remarkPlugins: [
|
|
76
|
+
// Ensure `data.astro` is available to all remark plugins
|
|
78
77
|
toRemarkInitializeAstroData({ userFrontmatter: frontmatter }),
|
|
79
78
|
...mdxPluginOpts.remarkPlugins ?? []
|
|
80
79
|
],
|
|
@@ -91,6 +90,7 @@ function mdx(partialMdxOptions = {}) {
|
|
|
91
90
|
},
|
|
92
91
|
{
|
|
93
92
|
name: "@astrojs/mdx-postprocess",
|
|
93
|
+
// These transforms must happen *after* JSX runtime transformations
|
|
94
94
|
transform(code, id) {
|
|
95
95
|
if (!id.endsWith(".mdx"))
|
|
96
96
|
return;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
|
2
2
|
import type { AstroConfig } from 'astro';
|
|
3
3
|
import type { VFile } from 'vfile';
|
|
4
|
-
import { MdxOptions } from './index.js';
|
|
4
|
+
import type { MdxOptions } from './index.js';
|
|
5
5
|
export declare function recmaInjectImportMetaEnvPlugin({ importMetaEnv, }: {
|
|
6
6
|
importMetaEnv: Record<string, any>;
|
|
7
7
|
}): (tree: any) => void;
|
package/dist/plugins.js
CHANGED
|
@@ -41,6 +41,8 @@ function rehypeApplyFrontmatterExport() {
|
|
|
41
41
|
const astroData = safelyGetAstroData(vfile.data);
|
|
42
42
|
if (astroData instanceof InvalidAstroDataError)
|
|
43
43
|
throw new Error(
|
|
44
|
+
// Copied from Astro core `errors-data`
|
|
45
|
+
// TODO: find way to import error data from core
|
|
44
46
|
'[MDX] A remark or rehype plugin attempted to inject invalid frontmatter. Ensure "astro.frontmatter" is set to a valid JSON object that is not `null` or `undefined`.'
|
|
45
47
|
);
|
|
46
48
|
const { frontmatter } = astroData;
|
|
@@ -50,6 +52,7 @@ function rehypeApplyFrontmatterExport() {
|
|
|
50
52
|
if (frontmatter.layout) {
|
|
51
53
|
exportNodes.unshift(
|
|
52
54
|
jsToTreeNode(
|
|
55
|
+
/** @see 'vite-plugin-markdown' for layout props reference */
|
|
53
56
|
`import { jsx as layoutJsx } from 'astro/jsx-runtime';
|
|
54
57
|
|
|
55
58
|
export default async function ({ children }) {
|
|
@@ -96,13 +99,18 @@ async function getRemarkPlugins(mdxOptions, config) {
|
|
|
96
99
|
}
|
|
97
100
|
function getRehypePlugins(mdxOptions) {
|
|
98
101
|
let rehypePlugins = [
|
|
102
|
+
// ensure `data.meta` is preserved in `properties.metastring` for rehype syntax highlighters
|
|
99
103
|
rehypeMetaString,
|
|
104
|
+
// rehypeRaw allows custom syntax highlighters to work without added config
|
|
100
105
|
[rehypeRaw, { passThrough: nodeTypes }]
|
|
101
106
|
];
|
|
102
107
|
rehypePlugins = [
|
|
103
108
|
...rehypePlugins,
|
|
104
109
|
...mdxOptions.rehypePlugins,
|
|
110
|
+
// getHeadings() is guaranteed by TS, so this must be included.
|
|
111
|
+
// We run `rehypeHeadingIds` _last_ to respect any custom IDs set by user plugins.
|
|
105
112
|
...isPerformanceBenchmark ? [] : [rehypeHeadingIds, rehypeInjectHeadingsExport],
|
|
113
|
+
// computed from `astro.data.frontmatter` in VFile data
|
|
106
114
|
rehypeApplyFrontmatterExport
|
|
107
115
|
];
|
|
108
116
|
return rehypePlugins;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MarkdownVFile } from '@astrojs/markdown-remark';
|
|
1
|
+
import type { MarkdownVFile } from '@astrojs/markdown-remark';
|
|
2
2
|
export declare function rehypeInjectHeadingsExport(): (tree: any, file: MarkdownVFile) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/mdx",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.18.
|
|
3
|
+
"description": "Add support for MDX pages in your Astro site",
|
|
4
|
+
"version": "0.18.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"./package.json": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@astrojs/markdown-remark": "^2.1.
|
|
27
|
-
"@astrojs/prism": "^2.1.
|
|
26
|
+
"@astrojs/markdown-remark": "^2.1.1",
|
|
27
|
+
"@astrojs/prism": "^2.1.1",
|
|
28
28
|
"@mdx-js/mdx": "^2.3.0",
|
|
29
29
|
"@mdx-js/rollup": "^2.3.0",
|
|
30
30
|
"acorn": "^8.8.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/mdast": "^3.0.10",
|
|
49
49
|
"@types/mocha": "^9.1.1",
|
|
50
50
|
"@types/yargs-parser": "^21.0.0",
|
|
51
|
-
"astro": "2.1.
|
|
51
|
+
"astro": "2.1.4",
|
|
52
52
|
"astro-scripts": "0.0.14",
|
|
53
53
|
"chai": "^4.3.6",
|
|
54
54
|
"cheerio": "^1.0.0-rc.11",
|
|
@@ -57,7 +57,9 @@
|
|
|
57
57
|
"mdast-util-to-string": "^3.1.0",
|
|
58
58
|
"mocha": "^9.2.2",
|
|
59
59
|
"reading-time": "^1.5.0",
|
|
60
|
+
"rehype-mathjax": "^4.0.2",
|
|
60
61
|
"rehype-pretty-code": "^0.4.0",
|
|
62
|
+
"remark-math": "^5.1.1",
|
|
61
63
|
"remark-rehype": "^10.1.0",
|
|
62
64
|
"remark-shiki-twoslash": "^3.1.0",
|
|
63
65
|
"remark-toc": "^8.0.1",
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
|
2
2
|
import { toRemarkInitializeAstroData } from '@astrojs/markdown-remark/dist/internal.js';
|
|
3
3
|
import { compile as mdxCompile } from '@mdx-js/mdx';
|
|
4
|
-
import { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
5
|
-
import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
|
4
|
+
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
5
|
+
import mdxPlugin, { type Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
|
6
6
|
import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro';
|
|
7
7
|
import { parse as parseESM } from 'es-module-lexer';
|
|
8
8
|
import fs from 'node:fs/promises';
|
|
@@ -23,33 +23,21 @@ export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | '
|
|
|
23
23
|
remarkRehype: RemarkRehypeOptions;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
type
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// `addPageExtension` and `contentEntryType` are not a public APIs
|
|
32
|
-
// Add type defs here
|
|
33
|
-
addPageExtension: (extension: string) => void;
|
|
34
|
-
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
35
|
-
}
|
|
36
|
-
) => void | Promise<void>;
|
|
37
|
-
};
|
|
26
|
+
type SetupHookParams = HookParameters<'astro:config:setup'> & {
|
|
27
|
+
// `addPageExtension` and `contentEntryType` are not a public APIs
|
|
28
|
+
// Add type defs here
|
|
29
|
+
addPageExtension: (extension: string) => void;
|
|
30
|
+
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
38
31
|
};
|
|
39
32
|
|
|
40
|
-
export default function mdx(
|
|
41
|
-
partialMdxOptions: Partial<MdxOptions> = {}
|
|
42
|
-
): IntegrationWithPrivateHooks {
|
|
33
|
+
export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroIntegration {
|
|
43
34
|
return {
|
|
44
35
|
name: '@astrojs/mdx',
|
|
45
36
|
hooks: {
|
|
46
|
-
'astro:config:setup': async ({
|
|
47
|
-
updateConfig,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
addContentEntryType,
|
|
51
|
-
command,
|
|
52
|
-
}) => {
|
|
37
|
+
'astro:config:setup': async (params) => {
|
|
38
|
+
const { updateConfig, config, addPageExtension, addContentEntryType, command } =
|
|
39
|
+
params as SetupHookParams;
|
|
40
|
+
|
|
53
41
|
addPageExtension('.mdx');
|
|
54
42
|
addContentEntryType({
|
|
55
43
|
extensions: ['.mdx'],
|
package/src/plugins.ts
CHANGED
|
@@ -13,7 +13,7 @@ import rehypeRaw from 'rehype-raw';
|
|
|
13
13
|
import remarkGfm from 'remark-gfm';
|
|
14
14
|
import remarkSmartypants from 'remark-smartypants';
|
|
15
15
|
import type { VFile } from 'vfile';
|
|
16
|
-
import { MdxOptions } from './index.js';
|
|
16
|
+
import type { MdxOptions } from './index.js';
|
|
17
17
|
import { rehypeInjectHeadingsExport } from './rehype-collect-headings.js';
|
|
18
18
|
import rehypeMetaString from './rehype-meta-string.js';
|
|
19
19
|
import remarkPrism from './remark-prism.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import mdx from '@astrojs/mdx';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { parseHTML } from 'linkedom';
|
|
4
|
+
import { loadFixture } from '../../../astro/test/test-utils.js';
|
|
5
|
+
import remarkMath from 'remark-math';
|
|
6
|
+
import rehypeMathjaxSvg from 'rehype-mathjax';
|
|
7
|
+
import rehypeMathjaxChtml from 'rehype-mathjax/chtml.js';
|
|
8
|
+
|
|
9
|
+
const FIXTURE_ROOT = new URL('./fixtures/mdx-math/', import.meta.url);
|
|
10
|
+
|
|
11
|
+
describe('MDX math', () => {
|
|
12
|
+
describe('mathjax', () => {
|
|
13
|
+
it('works with svg', async () => {
|
|
14
|
+
const fixture = await loadFixture({
|
|
15
|
+
root: FIXTURE_ROOT,
|
|
16
|
+
markdown: {
|
|
17
|
+
remarkPlugins: [remarkMath],
|
|
18
|
+
rehypePlugins: [rehypeMathjaxSvg],
|
|
19
|
+
},
|
|
20
|
+
integrations: [mdx()],
|
|
21
|
+
});
|
|
22
|
+
await fixture.build();
|
|
23
|
+
|
|
24
|
+
const html = await fixture.readFile('/mathjax/index.html');
|
|
25
|
+
const { document } = parseHTML(html);
|
|
26
|
+
|
|
27
|
+
const mjxContainer = document.querySelector('mjx-container[jax="SVG"]');
|
|
28
|
+
expect(mjxContainer).to.not.be.null;
|
|
29
|
+
|
|
30
|
+
const mjxStyle = document.querySelector('style').innerHTML;
|
|
31
|
+
expect(mjxStyle).to.include('mjx-container[jax="SVG"]', 'style should not be html-escaped');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('works with chtml', async () => {
|
|
35
|
+
const fixture = await loadFixture({
|
|
36
|
+
root: FIXTURE_ROOT,
|
|
37
|
+
markdown: {
|
|
38
|
+
remarkPlugins: [remarkMath],
|
|
39
|
+
rehypePlugins: [
|
|
40
|
+
[
|
|
41
|
+
rehypeMathjaxChtml,
|
|
42
|
+
{
|
|
43
|
+
chtml: {
|
|
44
|
+
fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
integrations: [mdx()],
|
|
51
|
+
});
|
|
52
|
+
await fixture.build();
|
|
53
|
+
|
|
54
|
+
const html = await fixture.readFile('/mathjax/index.html');
|
|
55
|
+
const { document } = parseHTML(html);
|
|
56
|
+
|
|
57
|
+
const mjxContainer = document.querySelector('mjx-container[jax="CHTML"]');
|
|
58
|
+
expect(mjxContainer).to.not.be.null;
|
|
59
|
+
|
|
60
|
+
const mjxStyle = document.querySelector('style').innerHTML;
|
|
61
|
+
expect(mjxStyle).to.include('mjx-container[jax="CHTML"]', 'style should not be html-escaped');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import mdx from '@astrojs/mdx';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { parseHTML } from 'linkedom';
|
|
4
|
+
import { loadFixture } from '../../../astro/test/test-utils.js';
|
|
5
|
+
|
|
6
|
+
const FIXTURE_ROOT = new URL('./fixtures/mdx-script-style-raw/', import.meta.url);
|
|
7
|
+
|
|
8
|
+
describe('MDX script style raw', () => {
|
|
9
|
+
describe('dev', () => {
|
|
10
|
+
let fixture;
|
|
11
|
+
let devServer;
|
|
12
|
+
|
|
13
|
+
before(async () => {
|
|
14
|
+
fixture = await loadFixture({
|
|
15
|
+
root: FIXTURE_ROOT,
|
|
16
|
+
integrations: [mdx()],
|
|
17
|
+
});
|
|
18
|
+
devServer = await fixture.startDevServer();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
after(async () => {
|
|
22
|
+
await devServer.stop();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('works with with raw script and style strings', async () => {
|
|
26
|
+
const res = await fixture.fetch('/index.html');
|
|
27
|
+
expect(res.status).to.equal(200);
|
|
28
|
+
|
|
29
|
+
const html = await res.text();
|
|
30
|
+
const { document } = parseHTML(html);
|
|
31
|
+
|
|
32
|
+
const scriptContent = document.getElementById('test-script').innerHTML;
|
|
33
|
+
expect(scriptContent).to.include(
|
|
34
|
+
"console.log('raw script')",
|
|
35
|
+
'script should not be html-escaped'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const styleContent = document.getElementById('test-style').innerHTML;
|
|
39
|
+
expect(styleContent).to.include(
|
|
40
|
+
'h1[id="script-style-raw"]',
|
|
41
|
+
'style should not be html-escaped'
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('build', () => {
|
|
47
|
+
it('works with with raw script and style strings', async () => {
|
|
48
|
+
const fixture = await loadFixture({
|
|
49
|
+
root: FIXTURE_ROOT,
|
|
50
|
+
integrations: [mdx()],
|
|
51
|
+
});
|
|
52
|
+
await fixture.build();
|
|
53
|
+
|
|
54
|
+
const html = await fixture.readFile('/index.html');
|
|
55
|
+
const { document } = parseHTML(html);
|
|
56
|
+
|
|
57
|
+
const scriptContent = document.getElementById('test-script').innerHTML;
|
|
58
|
+
expect(scriptContent).to.include(
|
|
59
|
+
"console.log('raw script')",
|
|
60
|
+
'script should not be html-escaped'
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const styleContent = document.getElementById('test-style').innerHTML;
|
|
64
|
+
expect(styleContent).to.include(
|
|
65
|
+
'h1[id="script-style-raw"]',
|
|
66
|
+
'style should not be html-escaped'
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|