@astrojs/mdx 0.19.1 → 0.19.3

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.
Files changed (140) hide show
  1. package/dist/index.js +4 -1
  2. package/package.json +8 -4
  3. package/.turbo/turbo-build.log +0 -4
  4. package/CHANGELOG.md +0 -725
  5. package/src/index.ts +0 -226
  6. package/src/plugins.ts +0 -185
  7. package/src/rehype-collect-headings.ts +0 -11
  8. package/src/rehype-meta-string.ts +0 -17
  9. package/src/remark-images-to-component.ts +0 -98
  10. package/src/remark-prism.ts +0 -18
  11. package/src/remark-shiki.ts +0 -115
  12. package/src/utils.ts +0 -108
  13. package/test/css-head-mdx.test.js +0 -98
  14. package/test/fixtures/css-head-mdx/node_modules/.bin/astro +0 -17
  15. package/test/fixtures/css-head-mdx/package.json +0 -10
  16. package/test/fixtures/css-head-mdx/src/components/BaseHead.astro +0 -11
  17. package/test/fixtures/css-head-mdx/src/components/BasicBlock.astro +0 -14
  18. package/test/fixtures/css-head-mdx/src/components/GenericComponent.astro +0 -1
  19. package/test/fixtures/css-head-mdx/src/components/HelloWorld.astro +0 -11
  20. package/test/fixtures/css-head-mdx/src/components/MDXWrapper.astro +0 -9
  21. package/test/fixtures/css-head-mdx/src/components/P.astro +0 -3
  22. package/test/fixtures/css-head-mdx/src/components/SmallCaps.astro +0 -3
  23. package/test/fixtures/css-head-mdx/src/components/UsingMdx.astro +0 -8
  24. package/test/fixtures/css-head-mdx/src/components/WithHoistedScripts.astro +0 -6
  25. package/test/fixtures/css-head-mdx/src/content/blog/_styles.css +0 -3
  26. package/test/fixtures/css-head-mdx/src/content/blog/using-mdx.mdx +0 -6
  27. package/test/fixtures/css-head-mdx/src/content/posts/test.mdx +0 -5
  28. package/test/fixtures/css-head-mdx/src/content/posts/using-component.mdx +0 -13
  29. package/test/fixtures/css-head-mdx/src/layouts/ContentLayout.astro +0 -18
  30. package/test/fixtures/css-head-mdx/src/layouts/DocumentLayout.astro +0 -15
  31. package/test/fixtures/css-head-mdx/src/layouts/One.astro +0 -15
  32. package/test/fixtures/css-head-mdx/src/layouts/Three.astro +0 -6
  33. package/test/fixtures/css-head-mdx/src/layouts/Two.astro +0 -6
  34. package/test/fixtures/css-head-mdx/src/pages/DirectContentUsage.astro +0 -17
  35. package/test/fixtures/css-head-mdx/src/pages/componentwithtext.mdx +0 -12
  36. package/test/fixtures/css-head-mdx/src/pages/indexOne.astro +0 -10
  37. package/test/fixtures/css-head-mdx/src/pages/indexThree.astro +0 -10
  38. package/test/fixtures/css-head-mdx/src/pages/indexTwo.astro +0 -10
  39. package/test/fixtures/css-head-mdx/src/pages/noLayoutWithComponent.mdx +0 -22
  40. package/test/fixtures/css-head-mdx/src/pages/posts/[post].astro +0 -18
  41. package/test/fixtures/css-head-mdx/src/pages/remote.astro +0 -17
  42. package/test/fixtures/css-head-mdx/src/pages/testOne.mdx +0 -15
  43. package/test/fixtures/css-head-mdx/src/pages/testThree.mdx +0 -15
  44. package/test/fixtures/css-head-mdx/src/pages/testTwo.mdx +0 -15
  45. package/test/fixtures/css-head-mdx/src/styles/global.css +0 -3
  46. package/test/fixtures/css-head-mdx/src/test.mdx +0 -14
  47. package/test/fixtures/mdx-astro-markdown-remarkRehype/src/pages/index.mdx +0 -5
  48. package/test/fixtures/mdx-component/src/components/Test.mdx +0 -3
  49. package/test/fixtures/mdx-component/src/components/WithFragment.mdx +0 -3
  50. package/test/fixtures/mdx-component/src/pages/glob.astro +0 -20
  51. package/test/fixtures/mdx-component/src/pages/index.astro +0 -5
  52. package/test/fixtures/mdx-component/src/pages/w-fragment.astro +0 -5
  53. package/test/fixtures/mdx-escape/src/components/Em.astro +0 -7
  54. package/test/fixtures/mdx-escape/src/components/P.astro +0 -1
  55. package/test/fixtures/mdx-escape/src/components/Title.astro +0 -1
  56. package/test/fixtures/mdx-escape/src/pages/html-tag.mdx +0 -5
  57. package/test/fixtures/mdx-escape/src/pages/index.mdx +0 -13
  58. package/test/fixtures/mdx-frontmatter/src/layouts/Base.astro +0 -38
  59. package/test/fixtures/mdx-frontmatter/src/pages/glob.json.js +0 -9
  60. package/test/fixtures/mdx-frontmatter/src/pages/index.mdx +0 -10
  61. package/test/fixtures/mdx-frontmatter/src/pages/with-headings.mdx +0 -7
  62. package/test/fixtures/mdx-frontmatter-injection/astro.config.mjs +0 -12
  63. package/test/fixtures/mdx-frontmatter-injection/node_modules/.bin/astro +0 -17
  64. package/test/fixtures/mdx-frontmatter-injection/package.json +0 -12
  65. package/test/fixtures/mdx-frontmatter-injection/src/layouts/Base.astro +0 -17
  66. package/test/fixtures/mdx-frontmatter-injection/src/markdown-plugins.mjs +0 -27
  67. package/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js +0 -6
  68. package/test/fixtures/mdx-frontmatter-injection/src/pages/page-1.mdx +0 -8
  69. package/test/fixtures/mdx-frontmatter-injection/src/pages/page-2.mdx +0 -24
  70. package/test/fixtures/mdx-get-headings/src/pages/pages.json.js +0 -11
  71. package/test/fixtures/mdx-get-headings/src/pages/test-with-frontmatter.mdx +0 -45
  72. package/test/fixtures/mdx-get-headings/src/pages/test-with-jsx-expressions.mdx +0 -8
  73. package/test/fixtures/mdx-get-headings/src/pages/test.mdx +0 -9
  74. package/test/fixtures/mdx-get-static-paths/src/content/1.mdx +0 -5
  75. package/test/fixtures/mdx-get-static-paths/src/pages/[slug].astro +0 -34
  76. package/test/fixtures/mdx-images/astro.config.ts +0 -8
  77. package/test/fixtures/mdx-images/node_modules/.bin/astro +0 -17
  78. package/test/fixtures/mdx-images/package.json +0 -10
  79. package/test/fixtures/mdx-images/src/assets/houston in space.webp +0 -0
  80. package/test/fixtures/mdx-images/src/assets/houston.webp +0 -0
  81. package/test/fixtures/mdx-images/src/pages/index.mdx +0 -11
  82. package/test/fixtures/mdx-infinite-loop/astro.config.ts +0 -6
  83. package/test/fixtures/mdx-infinite-loop/node_modules/.bin/astro +0 -17
  84. package/test/fixtures/mdx-infinite-loop/package.json +0 -11
  85. package/test/fixtures/mdx-infinite-loop/src/components/Test.js +0 -3
  86. package/test/fixtures/mdx-infinite-loop/src/pages/doc.mdx +0 -6
  87. package/test/fixtures/mdx-infinite-loop/src/pages/index.astro +0 -5
  88. package/test/fixtures/mdx-math/src/pages/mathjax.mdx +0 -5
  89. package/test/fixtures/mdx-namespace/astro.config.mjs +0 -6
  90. package/test/fixtures/mdx-namespace/node_modules/.bin/astro +0 -17
  91. package/test/fixtures/mdx-namespace/package.json +0 -11
  92. package/test/fixtures/mdx-namespace/src/components/Component.jsx +0 -6
  93. package/test/fixtures/mdx-namespace/src/pages/object.mdx +0 -3
  94. package/test/fixtures/mdx-namespace/src/pages/star.mdx +0 -3
  95. package/test/fixtures/mdx-page/astro.config.ts +0 -5
  96. package/test/fixtures/mdx-page/node_modules/.bin/astro +0 -17
  97. package/test/fixtures/mdx-page/package.json +0 -10
  98. package/test/fixtures/mdx-page/src/pages/index.mdx +0 -3
  99. package/test/fixtures/mdx-page/src/styles.css +0 -3
  100. package/test/fixtures/mdx-plugins/src/pages/with-plugins.mdx +0 -25
  101. package/test/fixtures/mdx-plus-react/astro.config.mjs +0 -6
  102. package/test/fixtures/mdx-plus-react/node_modules/.bin/astro +0 -17
  103. package/test/fixtures/mdx-plus-react/package.json +0 -11
  104. package/test/fixtures/mdx-plus-react/src/components/Component.jsx +0 -5
  105. package/test/fixtures/mdx-plus-react/src/pages/index.astro +0 -11
  106. package/test/fixtures/mdx-script-style-raw/src/pages/index.mdx +0 -13
  107. package/test/fixtures/mdx-slots/src/components/Slotted.astro +0 -4
  108. package/test/fixtures/mdx-slots/src/components/Test.mdx +0 -15
  109. package/test/fixtures/mdx-slots/src/pages/glob.astro +0 -11
  110. package/test/fixtures/mdx-slots/src/pages/index.astro +0 -5
  111. package/test/fixtures/mdx-syntax-hightlighting/src/pages/index.mdx +0 -9
  112. package/test/fixtures/mdx-url-export/src/pages/pages.json.js +0 -9
  113. package/test/fixtures/mdx-url-export/src/pages/test-1.mdx +0 -1
  114. package/test/fixtures/mdx-url-export/src/pages/test-2.mdx +0 -1
  115. package/test/fixtures/mdx-url-export/src/pages/with-url-override.mdx +0 -3
  116. package/test/fixtures/mdx-vite-env-vars/astro.config.mjs +0 -9
  117. package/test/fixtures/mdx-vite-env-vars/node_modules/.bin/astro +0 -17
  118. package/test/fixtures/mdx-vite-env-vars/package.json +0 -8
  119. package/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js +0 -7
  120. package/test/fixtures/mdx-vite-env-vars/src/pages/vite-env-vars.mdx +0 -38
  121. package/test/mdx-astro-markdown-remarkRehype.test.js +0 -85
  122. package/test/mdx-component.test.js +0 -191
  123. package/test/mdx-escape.test.js +0 -32
  124. package/test/mdx-frontmatter-injection.test.js +0 -53
  125. package/test/mdx-frontmatter.test.js +0 -77
  126. package/test/mdx-get-headings.test.js +0 -194
  127. package/test/mdx-get-static-paths.test.js +0 -32
  128. package/test/mdx-images.test.js +0 -40
  129. package/test/mdx-infinite-loop.test.js +0 -30
  130. package/test/mdx-math.test.js +0 -64
  131. package/test/mdx-namespace.test.js +0 -83
  132. package/test/mdx-page.test.js +0 -64
  133. package/test/mdx-plugins.test.js +0 -285
  134. package/test/mdx-plus-react.test.js +0 -25
  135. package/test/mdx-script-style-raw.test.js +0 -70
  136. package/test/mdx-slots.js +0 -124
  137. package/test/mdx-syntax-highlighting.test.js +0 -145
  138. package/test/mdx-url-export.test.js +0 -28
  139. package/test/mdx-vite-env-vars.test.js +0 -54
  140. package/tsconfig.json +0 -10
package/src/utils.ts DELETED
@@ -1,108 +0,0 @@
1
- import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
2
- import type { Options as AcornOpts } from 'acorn';
3
- import { parse } from 'acorn';
4
- import type { AstroConfig, SSRError } from 'astro';
5
- import matter from 'gray-matter';
6
- import { bold, yellow } from 'kleur/colors';
7
- import type { MdxjsEsm } from 'mdast-util-mdx';
8
-
9
- function appendForwardSlash(path: string) {
10
- return path.endsWith('/') ? path : path + '/';
11
- }
12
-
13
- interface FileInfo {
14
- fileId: string;
15
- fileUrl: string;
16
- }
17
-
18
- /** @see 'vite-plugin-utils' for source */
19
- export function getFileInfo(id: string, config: AstroConfig): FileInfo {
20
- const sitePathname = appendForwardSlash(
21
- config.site ? new URL(config.base, config.site).pathname : config.base
22
- );
23
-
24
- // Try to grab the file's actual URL
25
- let url: URL | undefined = undefined;
26
- try {
27
- url = new URL(`file://${id}`);
28
- } catch {}
29
-
30
- const fileId = id.split('?')[0];
31
- let fileUrl: string;
32
- const isPage = fileId.includes('/pages/');
33
- if (isPage) {
34
- fileUrl = fileId.replace(/^.*?\/pages\//, sitePathname).replace(/(\/index)?\.mdx$/, '');
35
- } else if (url && url.pathname.startsWith(config.root.pathname)) {
36
- fileUrl = url.pathname.slice(config.root.pathname.length);
37
- } else {
38
- fileUrl = fileId;
39
- }
40
-
41
- if (fileUrl && config.trailingSlash === 'always') {
42
- fileUrl = appendForwardSlash(fileUrl);
43
- }
44
- return { fileId, fileUrl };
45
- }
46
-
47
- /**
48
- * Match YAML exception handling from Astro core errors
49
- * @see 'astro/src/core/errors.ts'
50
- */
51
- export function parseFrontmatter(code: string, id: string) {
52
- try {
53
- return matter(code);
54
- } catch (e: any) {
55
- if (e.name === 'YAMLException') {
56
- const err: SSRError = e;
57
- err.id = id;
58
- err.loc = { file: e.id, line: e.mark.line + 1, column: e.mark.column };
59
- err.message = e.reason;
60
- throw err;
61
- } else {
62
- throw e;
63
- }
64
- }
65
- }
66
-
67
- export function jsToTreeNode(
68
- jsString: string,
69
- acornOpts: AcornOpts = {
70
- ecmaVersion: 'latest',
71
- sourceType: 'module',
72
- }
73
- ): MdxjsEsm {
74
- return {
75
- type: 'mdxjsEsm',
76
- value: '',
77
- data: {
78
- estree: {
79
- body: [],
80
- ...parse(jsString, acornOpts),
81
- type: 'Program',
82
- sourceType: 'module',
83
- },
84
- },
85
- };
86
- }
87
-
88
- export function ignoreStringPlugins(plugins: any[]): PluggableList {
89
- let validPlugins: PluggableList = [];
90
- let hasInvalidPlugin = false;
91
- for (const plugin of plugins) {
92
- if (typeof plugin === 'string') {
93
- console.warn(yellow(`[MDX] ${bold(plugin)} not applied.`));
94
- hasInvalidPlugin = true;
95
- } else if (Array.isArray(plugin) && typeof plugin[0] === 'string') {
96
- console.warn(yellow(`[MDX] ${bold(plugin[0])} not applied.`));
97
- hasInvalidPlugin = true;
98
- } else {
99
- validPlugins.push(plugin);
100
- }
101
- }
102
- if (hasInvalidPlugin) {
103
- console.warn(
104
- `To inherit Markdown plugins in MDX, please use explicit imports in your config instead of "strings." See Markdown docs: https://docs.astro.build/en/guides/markdown-content/#markdown-plugins`
105
- );
106
- }
107
- return validPlugins;
108
- }
@@ -1,98 +0,0 @@
1
- import mdx from '@astrojs/mdx';
2
-
3
- import { expect } from 'chai';
4
- import { parseHTML } from 'linkedom';
5
- import { loadFixture } from '../../../astro/test/test-utils.js';
6
- import * as cheerio from 'cheerio';
7
-
8
- describe('Head injection w/ MDX', () => {
9
- let fixture;
10
-
11
- before(async () => {
12
- fixture = await loadFixture({
13
- root: new URL('./fixtures/css-head-mdx/', import.meta.url),
14
- integrations: [mdx()],
15
- });
16
- });
17
-
18
- describe('build', () => {
19
- before(async () => {
20
- await fixture.build();
21
- });
22
-
23
- it('only injects contents into head', async () => {
24
- const html = await fixture.readFile('/indexThree/index.html');
25
- const { document } = parseHTML(html);
26
-
27
- const links = document.querySelectorAll('head link[rel=stylesheet]');
28
- expect(links).to.have.a.lengthOf(1);
29
-
30
- const scripts = document.querySelectorAll('head script[type=module]');
31
- expect(scripts).to.have.a.lengthOf(1);
32
- });
33
-
34
- it('injects into the head for content collections', async () => {
35
- const html = await fixture.readFile('/posts/test/index.html');
36
- const { document } = parseHTML(html);
37
-
38
- const links = document.querySelectorAll('head link[rel=stylesheet]');
39
- expect(links).to.have.a.lengthOf(1);
40
- });
41
-
42
- it('injects content from a component using Content#render()', async () => {
43
- const html = await fixture.readFile('/DirectContentUsage/index.html');
44
- const { document } = parseHTML(html);
45
-
46
- const links = document.querySelectorAll('head link[rel=stylesheet]');
47
- expect(links).to.have.a.lengthOf(1);
48
-
49
- const scripts = document.querySelectorAll('head script[type=module]');
50
- expect(scripts).to.have.a.lengthOf(2);
51
- });
52
-
53
- it('Using component using slots.render() API', async () => {
54
- const html = await fixture.readFile('/remote/index.html');
55
- const { document } = parseHTML(html);
56
-
57
- const links = document.querySelectorAll('head link[rel=stylesheet]');
58
- expect(links).to.have.a.lengthOf(1);
59
- });
60
-
61
- it('Using component but no layout', async () => {
62
- const html = await fixture.readFile('/noLayoutWithComponent/index.html');
63
- // Using cheerio here because linkedom doesn't support head tag injection
64
- const $ = cheerio.load(html);
65
-
66
- const headLinks = $('head link[rel=stylesheet]');
67
- expect(headLinks).to.have.a.lengthOf(1);
68
-
69
- const bodyLinks = $('body link[rel=stylesheet]');
70
- expect(bodyLinks).to.have.a.lengthOf(0);
71
- });
72
-
73
- it('JSX component rendering Astro children within head buffering phase', async () => {
74
- const html = await fixture.readFile('/posts/using-component/index.html');
75
- // Using cheerio here because linkedom doesn't support head tag injection
76
- const $ = cheerio.load(html);
77
-
78
- const headLinks = $('head link[rel=stylesheet]');
79
- expect(headLinks).to.have.a.lengthOf(1);
80
-
81
- const bodyLinks = $('body link[rel=stylesheet]');
82
- expect(bodyLinks).to.have.a.lengthOf(0);
83
- });
84
-
85
- it('Injection caused by delayed slots', async () => {
86
- const html = await fixture.readFile('/componentwithtext/index.html');
87
-
88
- // Using cheerio here because linkedom doesn't support head tag injection
89
- const $ = cheerio.load(html);
90
-
91
- const headLinks = $('head link[rel=stylesheet]');
92
- expect(headLinks).to.have.a.lengthOf(1);
93
-
94
- const bodyLinks = $('body link[rel=stylesheet]');
95
- expect(bodyLinks).to.have.a.lengthOf(0);
96
- });
97
- });
98
- });
@@ -1,17 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
- esac
7
-
8
- if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/astro/astro/packages/astro/node_modules:/home/runner/work/astro/astro/packages/node_modules:/home/runner/work/astro/astro/node_modules:/home/runner/work/astro/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
10
- else
11
- export NODE_PATH="/home/runner/work/astro/astro/packages/astro/node_modules:/home/runner/work/astro/astro/packages/node_modules:/home/runner/work/astro/astro/node_modules:/home/runner/work/astro/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/astro/astro/node_modules/.pnpm/node_modules:$NODE_PATH"
12
- fi
13
- if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"
15
- else
16
- exec node "$basedir/../../../../../../../astro/astro.js" "$@"
17
- fi
@@ -1,10 +0,0 @@
1
- {
2
- "name": "@test/mdx-css-head-mdx",
3
- "version": "0.0.0",
4
- "private": true,
5
- "dependencies": {
6
- "astro": "workspace:*",
7
- "@astrojs/mdx": "workspace:*",
8
- "astro-remote": "0.2.3"
9
- }
10
- }
@@ -1,11 +0,0 @@
1
- ---
2
- const { title } = Astro.props;
3
- ---
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
- <meta name="generator" content={Astro.generator} />
8
- <title>{title}</title>
9
- <style is:global>
10
- @import "../styles/global.css";
11
- </style>
@@ -1,14 +0,0 @@
1
- ---
2
- const { inlineStyle, title, display = 'horizontal' } = Astro.props;
3
- const lineEnding = display === 'horizontal' ? ', ' : '<br>';
4
- ---
5
-
6
- {title && <h2 set:html={title} />}
7
- <address style={inlineStyle}>
8
- <span class="name">some name</span><Fragment set:html={lineEnding} />
9
- line 1<Fragment set:html={lineEnding} />
10
- line 2<Fragment set:html={lineEnding} />
11
- line 3<Fragment set:html={lineEnding} />
12
- line 4<Fragment set:html={lineEnding} />
13
- line 5
14
- </address>
@@ -1 +0,0 @@
1
- <span>just a generic component</span>
@@ -1,11 +0,0 @@
1
- ---
2
- ---
3
-
4
- <h3>Hello world!!</h3>
5
- <slot />
6
-
7
- <style>h3 { color: red }</style>
8
-
9
- <script>
10
- console.log('hellooooo')
11
- </script>
@@ -1,9 +0,0 @@
1
- ---
2
- import Component from "./GenericComponent.astro";
3
- ---
4
-
5
- <div>
6
- <slot name="title" />
7
- <slot name="intro" class="inline" />
8
- <Component />
9
- </div>
@@ -1,3 +0,0 @@
1
- <p>
2
- <slot />
3
- </p>
@@ -1,3 +0,0 @@
1
- ---
2
- ---
3
- <span style={{fontVariant: "small-caps"}}><slot /></span>
@@ -1,8 +0,0 @@
1
- ---
2
- import { getEntryBySlug } from 'astro:content';
3
-
4
- const launchWeek = await getEntryBySlug('blog', 'using-mdx');
5
- const { Content } = await launchWeek.render();
6
- ---
7
-
8
- <Content />
@@ -1,6 +0,0 @@
1
- ---
2
- ---
3
-
4
- <script>
5
- console.log('hoisted')
6
- </script>
@@ -1,3 +0,0 @@
1
- body {
2
- color: red !important;
3
- }
@@ -1,6 +0,0 @@
1
- import './_styles.css';
2
- import WithHoistedScripts from '../../components/WithHoistedScripts.astro';
3
-
4
- # Using mdx
5
-
6
- <WithHoistedScripts />
@@ -1,5 +0,0 @@
1
- ---
2
- title: Testing
3
- ---
4
-
5
- <SmallCaps>A test file</SmallCaps>
@@ -1,13 +0,0 @@
1
- ---
2
- title: testing
3
- ---
4
- import MDXWrapper from "../../components/MDXWrapper.astro";
5
-
6
- <MDXWrapper>
7
- <h1 slot="title">
8
- testing
9
- </h1>
10
- <div slot="intro">
11
- Intro
12
- </div>
13
- </MDXWrapper>
@@ -1,18 +0,0 @@
1
- ---
2
- import BaseHead from "../components/BaseHead.astro";
3
- export interface Props {
4
- title: string;
5
- }
6
-
7
- const { title } = Astro.props;
8
- ---
9
-
10
- <!DOCTYPE html>
11
- <html lang="en">
12
- <head>
13
- <BaseHead title={title} />
14
- </head>
15
- <body>
16
- <slot />
17
- </body>
18
- </html>
@@ -1,15 +0,0 @@
1
- ---
2
- // Extend the BaseLayout, adding space for a banner at the top of the page
3
- // after the main heading, then the detail for the actual page
4
- import ContentLayout from './ContentLayout.astro';
5
- const { frontmatter } = Astro.props;
6
- ---
7
-
8
- <ContentLayout>
9
- <div class="content-container">
10
- <article id="main-content" class="pad-z5 flow">
11
- <h1 set:html={frontmatter.pageHeading ? frontmatter.pageHeading : frontmatter.title} />
12
- <slot />
13
- </article>
14
- </div>
15
- </ContentLayout>
@@ -1,15 +0,0 @@
1
- ---
2
- ---
3
-
4
- <html lang="en">
5
- <head>
6
- <meta charset="utf-8" />
7
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
- <meta name="viewport" content="width=device-width" />
9
- <meta name="generator" content={Astro.generator} />
10
- <title>Astro</title>
11
- </head>
12
- <body>
13
- <slot />
14
- </body>
15
- </html>
@@ -1,6 +0,0 @@
1
- ---
2
- import Two from './Two.astro'
3
- ---
4
- <Two>
5
- <slot />
6
- </Two>
@@ -1,6 +0,0 @@
1
- ---
2
- import One from './One.astro'
3
- ---
4
- <One>
5
- <slot />
6
- </One>
@@ -1,17 +0,0 @@
1
- ---
2
- import UsingMdx from '../components/UsingMdx.astro'
3
- ---
4
-
5
- <html lang="en">
6
- <head>
7
- <meta charset="utf-8" />
8
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
9
- <meta name="viewport" content="width=device-width" />
10
- <meta name="generator" content={Astro.generator} />
11
- <title>Astro</title>
12
- </head>
13
- <body>
14
- <h1>Astro</h1>
15
- <UsingMdx />
16
- </body>
17
- </html>
@@ -1,12 +0,0 @@
1
- ---
2
- layout: ../layouts/DocumentLayout.astro
3
- title: blah blah
4
- ---
5
-
6
- import BasicBlock from '../components/BasicBlock.astro';
7
-
8
- Some text for a paragraph.
9
-
10
- <BasicBlock title="This causes css in wrong place." />
11
-
12
- Some other text.
@@ -1,10 +0,0 @@
1
- ---
2
- import One from '../layouts/One.astro'
3
-
4
- import { Content } from '../test.mdx'
5
- ---
6
-
7
- <One>
8
- <h1>Astro</h1>
9
- <Content />
10
- </One>
@@ -1,10 +0,0 @@
1
- ---
2
- import Three from '../layouts/Three.astro'
3
-
4
- import { Content } from '../test.mdx'
5
- ---
6
-
7
- <Three>
8
- <h1>Astro</h1>
9
- <Content />
10
- </Three>
@@ -1,10 +0,0 @@
1
- ---
2
- import Two from '../layouts/Two.astro'
3
-
4
- import { Content } from '../test.mdx'
5
- ---
6
-
7
- <Two>
8
- <h1>Astro</h1>
9
- <Content />
10
- </Two>
@@ -1,22 +0,0 @@
1
- ---
2
- title: 'Lorem'
3
- description: 'Lorem ipsum dolor sit amet'
4
- pubDate: 'Jul 02 2022'
5
- ---
6
-
7
- import MyComponent from '../components/HelloWorld.astro';
8
-
9
-
10
- ## Lorem
11
-
12
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
13
-
14
- ## Lorem 2
15
-
16
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
17
-
18
- <MyComponent />
19
-
20
- ## Lorem 3
21
-
22
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@@ -1,18 +0,0 @@
1
- ---
2
- import { getCollection } from 'astro:content';
3
- import Layout from '../../layouts/ContentLayout.astro';
4
- import SmallCaps from '../../components/SmallCaps.astro';
5
-
6
- export async function getStaticPaths() {
7
- const entries = await getCollection('posts');
8
- return entries.map(entry => {
9
- return {params: { post: entry.slug }, props: { entry },
10
- }});
11
- }
12
-
13
- const { entry } = Astro.props;
14
- const { Content } = await entry.render();
15
- ---
16
- <Layout title="">
17
- <Content components={{ SmallCaps }} />
18
- </Layout>
@@ -1,17 +0,0 @@
1
- ---
2
- import '../styles/global.css'
3
- import Layout from '../layouts/One.astro';
4
- import Paragraph from '../components/P.astro';
5
- import { Markdown } from 'astro-remote'
6
- ---
7
-
8
- <Layout title="Welcome to Astro.">
9
- <main>
10
- <Markdown
11
- components={{
12
- p: Paragraph,
13
- }}>
14
- **Removing p component fixes the problem**
15
- </Markdown>
16
- </main>
17
- </Layout>
@@ -1,15 +0,0 @@
1
- ---
2
- layout: '../layouts/One.astro'
3
- title: "hello world"
4
- publishDate: "2023-01-01"
5
- ---
6
-
7
- import HelloWorld from '../components/HelloWorld.astro';
8
-
9
- # Test
10
-
11
- 123
12
-
13
- <HelloWorld />
14
-
15
- 456
@@ -1,15 +0,0 @@
1
- ---
2
- layout: '../layouts/Three.astro'
3
- title: "hello world"
4
- publishDate: "2023-01-01"
5
- ---
6
-
7
- import HelloWorld from '../components/HelloWorld.astro';
8
-
9
- # Test
10
-
11
- 123
12
-
13
- <HelloWorld />
14
-
15
- 456
@@ -1,15 +0,0 @@
1
- ---
2
- layout: '../layouts/Two.astro'
3
- title: "hello world"
4
- publishDate: "2023-01-01"
5
- ---
6
-
7
- import HelloWorld from '../components/HelloWorld.astro';
8
-
9
- # Test
10
-
11
- 123
12
-
13
- <HelloWorld />
14
-
15
- 456
@@ -1,3 +0,0 @@
1
- html {
2
- font-weight: bolder;
3
- }
@@ -1,14 +0,0 @@
1
- ---
2
- title: "hello world"
3
- publishDate: "2023-01-01"
4
- ---
5
-
6
- import HelloWorld from './components/HelloWorld.astro';
7
-
8
- # Test
9
-
10
- 123
11
-
12
- <HelloWorld />
13
-
14
- 456
@@ -1,5 +0,0 @@
1
- # Hello world
2
-
3
- This[^1] should be visible.
4
-
5
- [^1]: And there would be a footnote.
@@ -1,3 +0,0 @@
1
- # Hello component!
2
-
3
- <div id="foo">bar</div>
@@ -1,3 +0,0 @@
1
- # MDX containing `<Fragment />`
2
-
3
- <p><Fragment>bar</Fragment></p>
@@ -1,20 +0,0 @@
1
- ---
2
- import { parse } from 'node:path';
3
- const components = await Astro.glob('../components/*.mdx');
4
- ---
5
-
6
- <div data-default-export>
7
- {components.map(Component => (
8
- <div data-file={parse(Component.file).base}>
9
- <Component.default />
10
- </div>
11
- ))}
12
- </div>
13
-
14
- <div data-content-export>
15
- {components.map(({ Content, file }) => (
16
- <div data-file={parse(file).base}>
17
- <Content />
18
- </div>
19
- ))}
20
- </div>