@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.
- package/dist/index.js +4 -1
- package/package.json +8 -4
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -725
- package/src/index.ts +0 -226
- package/src/plugins.ts +0 -185
- package/src/rehype-collect-headings.ts +0 -11
- package/src/rehype-meta-string.ts +0 -17
- package/src/remark-images-to-component.ts +0 -98
- package/src/remark-prism.ts +0 -18
- package/src/remark-shiki.ts +0 -115
- package/src/utils.ts +0 -108
- package/test/css-head-mdx.test.js +0 -98
- package/test/fixtures/css-head-mdx/node_modules/.bin/astro +0 -17
- package/test/fixtures/css-head-mdx/package.json +0 -10
- package/test/fixtures/css-head-mdx/src/components/BaseHead.astro +0 -11
- package/test/fixtures/css-head-mdx/src/components/BasicBlock.astro +0 -14
- package/test/fixtures/css-head-mdx/src/components/GenericComponent.astro +0 -1
- package/test/fixtures/css-head-mdx/src/components/HelloWorld.astro +0 -11
- package/test/fixtures/css-head-mdx/src/components/MDXWrapper.astro +0 -9
- package/test/fixtures/css-head-mdx/src/components/P.astro +0 -3
- package/test/fixtures/css-head-mdx/src/components/SmallCaps.astro +0 -3
- package/test/fixtures/css-head-mdx/src/components/UsingMdx.astro +0 -8
- package/test/fixtures/css-head-mdx/src/components/WithHoistedScripts.astro +0 -6
- package/test/fixtures/css-head-mdx/src/content/blog/_styles.css +0 -3
- package/test/fixtures/css-head-mdx/src/content/blog/using-mdx.mdx +0 -6
- package/test/fixtures/css-head-mdx/src/content/posts/test.mdx +0 -5
- package/test/fixtures/css-head-mdx/src/content/posts/using-component.mdx +0 -13
- package/test/fixtures/css-head-mdx/src/layouts/ContentLayout.astro +0 -18
- package/test/fixtures/css-head-mdx/src/layouts/DocumentLayout.astro +0 -15
- package/test/fixtures/css-head-mdx/src/layouts/One.astro +0 -15
- package/test/fixtures/css-head-mdx/src/layouts/Three.astro +0 -6
- package/test/fixtures/css-head-mdx/src/layouts/Two.astro +0 -6
- package/test/fixtures/css-head-mdx/src/pages/DirectContentUsage.astro +0 -17
- package/test/fixtures/css-head-mdx/src/pages/componentwithtext.mdx +0 -12
- package/test/fixtures/css-head-mdx/src/pages/indexOne.astro +0 -10
- package/test/fixtures/css-head-mdx/src/pages/indexThree.astro +0 -10
- package/test/fixtures/css-head-mdx/src/pages/indexTwo.astro +0 -10
- package/test/fixtures/css-head-mdx/src/pages/noLayoutWithComponent.mdx +0 -22
- package/test/fixtures/css-head-mdx/src/pages/posts/[post].astro +0 -18
- package/test/fixtures/css-head-mdx/src/pages/remote.astro +0 -17
- package/test/fixtures/css-head-mdx/src/pages/testOne.mdx +0 -15
- package/test/fixtures/css-head-mdx/src/pages/testThree.mdx +0 -15
- package/test/fixtures/css-head-mdx/src/pages/testTwo.mdx +0 -15
- package/test/fixtures/css-head-mdx/src/styles/global.css +0 -3
- package/test/fixtures/css-head-mdx/src/test.mdx +0 -14
- package/test/fixtures/mdx-astro-markdown-remarkRehype/src/pages/index.mdx +0 -5
- package/test/fixtures/mdx-component/src/components/Test.mdx +0 -3
- package/test/fixtures/mdx-component/src/components/WithFragment.mdx +0 -3
- package/test/fixtures/mdx-component/src/pages/glob.astro +0 -20
- package/test/fixtures/mdx-component/src/pages/index.astro +0 -5
- package/test/fixtures/mdx-component/src/pages/w-fragment.astro +0 -5
- package/test/fixtures/mdx-escape/src/components/Em.astro +0 -7
- package/test/fixtures/mdx-escape/src/components/P.astro +0 -1
- package/test/fixtures/mdx-escape/src/components/Title.astro +0 -1
- package/test/fixtures/mdx-escape/src/pages/html-tag.mdx +0 -5
- package/test/fixtures/mdx-escape/src/pages/index.mdx +0 -13
- package/test/fixtures/mdx-frontmatter/src/layouts/Base.astro +0 -38
- package/test/fixtures/mdx-frontmatter/src/pages/glob.json.js +0 -9
- package/test/fixtures/mdx-frontmatter/src/pages/index.mdx +0 -10
- package/test/fixtures/mdx-frontmatter/src/pages/with-headings.mdx +0 -7
- package/test/fixtures/mdx-frontmatter-injection/astro.config.mjs +0 -12
- package/test/fixtures/mdx-frontmatter-injection/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-frontmatter-injection/package.json +0 -12
- package/test/fixtures/mdx-frontmatter-injection/src/layouts/Base.astro +0 -17
- package/test/fixtures/mdx-frontmatter-injection/src/markdown-plugins.mjs +0 -27
- package/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js +0 -6
- package/test/fixtures/mdx-frontmatter-injection/src/pages/page-1.mdx +0 -8
- package/test/fixtures/mdx-frontmatter-injection/src/pages/page-2.mdx +0 -24
- package/test/fixtures/mdx-get-headings/src/pages/pages.json.js +0 -11
- package/test/fixtures/mdx-get-headings/src/pages/test-with-frontmatter.mdx +0 -45
- package/test/fixtures/mdx-get-headings/src/pages/test-with-jsx-expressions.mdx +0 -8
- package/test/fixtures/mdx-get-headings/src/pages/test.mdx +0 -9
- package/test/fixtures/mdx-get-static-paths/src/content/1.mdx +0 -5
- package/test/fixtures/mdx-get-static-paths/src/pages/[slug].astro +0 -34
- package/test/fixtures/mdx-images/astro.config.ts +0 -8
- package/test/fixtures/mdx-images/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-images/package.json +0 -10
- package/test/fixtures/mdx-images/src/assets/houston in space.webp +0 -0
- package/test/fixtures/mdx-images/src/assets/houston.webp +0 -0
- package/test/fixtures/mdx-images/src/pages/index.mdx +0 -11
- package/test/fixtures/mdx-infinite-loop/astro.config.ts +0 -6
- package/test/fixtures/mdx-infinite-loop/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-infinite-loop/package.json +0 -11
- package/test/fixtures/mdx-infinite-loop/src/components/Test.js +0 -3
- package/test/fixtures/mdx-infinite-loop/src/pages/doc.mdx +0 -6
- package/test/fixtures/mdx-infinite-loop/src/pages/index.astro +0 -5
- package/test/fixtures/mdx-math/src/pages/mathjax.mdx +0 -5
- package/test/fixtures/mdx-namespace/astro.config.mjs +0 -6
- package/test/fixtures/mdx-namespace/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-namespace/package.json +0 -11
- package/test/fixtures/mdx-namespace/src/components/Component.jsx +0 -6
- package/test/fixtures/mdx-namespace/src/pages/object.mdx +0 -3
- package/test/fixtures/mdx-namespace/src/pages/star.mdx +0 -3
- package/test/fixtures/mdx-page/astro.config.ts +0 -5
- package/test/fixtures/mdx-page/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-page/package.json +0 -10
- package/test/fixtures/mdx-page/src/pages/index.mdx +0 -3
- package/test/fixtures/mdx-page/src/styles.css +0 -3
- package/test/fixtures/mdx-plugins/src/pages/with-plugins.mdx +0 -25
- package/test/fixtures/mdx-plus-react/astro.config.mjs +0 -6
- package/test/fixtures/mdx-plus-react/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-plus-react/package.json +0 -11
- package/test/fixtures/mdx-plus-react/src/components/Component.jsx +0 -5
- package/test/fixtures/mdx-plus-react/src/pages/index.astro +0 -11
- package/test/fixtures/mdx-script-style-raw/src/pages/index.mdx +0 -13
- package/test/fixtures/mdx-slots/src/components/Slotted.astro +0 -4
- package/test/fixtures/mdx-slots/src/components/Test.mdx +0 -15
- package/test/fixtures/mdx-slots/src/pages/glob.astro +0 -11
- package/test/fixtures/mdx-slots/src/pages/index.astro +0 -5
- package/test/fixtures/mdx-syntax-hightlighting/src/pages/index.mdx +0 -9
- package/test/fixtures/mdx-url-export/src/pages/pages.json.js +0 -9
- package/test/fixtures/mdx-url-export/src/pages/test-1.mdx +0 -1
- package/test/fixtures/mdx-url-export/src/pages/test-2.mdx +0 -1
- package/test/fixtures/mdx-url-export/src/pages/with-url-override.mdx +0 -3
- package/test/fixtures/mdx-vite-env-vars/astro.config.mjs +0 -9
- package/test/fixtures/mdx-vite-env-vars/node_modules/.bin/astro +0 -17
- package/test/fixtures/mdx-vite-env-vars/package.json +0 -8
- package/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js +0 -7
- package/test/fixtures/mdx-vite-env-vars/src/pages/vite-env-vars.mdx +0 -38
- package/test/mdx-astro-markdown-remarkRehype.test.js +0 -85
- package/test/mdx-component.test.js +0 -191
- package/test/mdx-escape.test.js +0 -32
- package/test/mdx-frontmatter-injection.test.js +0 -53
- package/test/mdx-frontmatter.test.js +0 -77
- package/test/mdx-get-headings.test.js +0 -194
- package/test/mdx-get-static-paths.test.js +0 -32
- package/test/mdx-images.test.js +0 -40
- package/test/mdx-infinite-loop.test.js +0 -30
- package/test/mdx-math.test.js +0 -64
- package/test/mdx-namespace.test.js +0 -83
- package/test/mdx-page.test.js +0 -64
- package/test/mdx-plugins.test.js +0 -285
- package/test/mdx-plus-react.test.js +0 -25
- package/test/mdx-script-style-raw.test.js +0 -70
- package/test/mdx-slots.js +0 -124
- package/test/mdx-syntax-highlighting.test.js +0 -145
- package/test/mdx-url-export.test.js +0 -28
- package/test/mdx-vite-env-vars.test.js +0 -54
- 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,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,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,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,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,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>
|