@astrojs/markdoc 0.1.2 → 0.2.0
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/README.md +8 -11
- package/dist/config.d.ts +38 -0
- package/dist/config.js +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +68 -25
- package/dist/load-config.d.ts +5 -12
- package/dist/nodes/heading.d.ts +4 -0
- package/dist/nodes/heading.js +39 -0
- package/dist/nodes/index.d.ts +4 -0
- package/dist/nodes/index.js +7 -0
- package/dist/runtime.d.ts +16 -0
- package/dist/runtime.js +63 -0
- package/package.json +11 -4
- package/template/content-module-types.d.ts +1 -0
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -129
- package/dist/default-config.d.ts +0 -5
- package/dist/default-config.js +0 -13
- package/src/config.ts +0 -5
- package/src/default-config.ts +0 -18
- package/src/experimental-assets-config.ts +0 -29
- package/src/index.ts +0 -164
- package/src/load-config.ts +0 -102
- package/src/utils.ts +0 -98
- package/test/content-collections.test.js +0 -110
- package/test/entry-prop.test.js +0 -58
- package/test/fixtures/content-collections/astro.config.mjs +0 -7
- package/test/fixtures/content-collections/node_modules/.bin/astro +0 -17
- package/test/fixtures/content-collections/package.json +0 -9
- package/test/fixtures/content-collections/src/content/blog/post-1.mdoc +0 -7
- package/test/fixtures/content-collections/src/content/blog/post-2.mdoc +0 -7
- package/test/fixtures/content-collections/src/content/blog/post-3.mdoc +0 -7
- package/test/fixtures/content-collections/src/content/config.ts +0 -12
- package/test/fixtures/content-collections/src/pages/collection.json.js +0 -10
- package/test/fixtures/content-collections/src/pages/entry.json.js +0 -10
- package/test/fixtures/content-collections/utils.js +0 -8
- package/test/fixtures/entry-prop/astro.config.mjs +0 -7
- package/test/fixtures/entry-prop/node_modules/.bin/astro +0 -17
- package/test/fixtures/entry-prop/package.json +0 -9
- package/test/fixtures/entry-prop/src/content/blog/entry.mdoc +0 -9
- package/test/fixtures/entry-prop/src/content/config.ts +0 -9
- package/test/fixtures/entry-prop/src/pages/index.astro +0 -19
- package/test/fixtures/image-assets/astro.config.mjs +0 -10
- package/test/fixtures/image-assets/node_modules/.bin/astro +0 -17
- package/test/fixtures/image-assets/package.json +0 -9
- package/test/fixtures/image-assets/src/assets/alias/cityscape.jpg +0 -0
- package/test/fixtures/image-assets/src/assets/relative/oar.jpg +0 -0
- package/test/fixtures/image-assets/src/content/docs/intro.mdoc +0 -7
- package/test/fixtures/image-assets/src/pages/index.astro +0 -19
- package/test/fixtures/image-assets/src/public/favicon.svg +0 -9
- package/test/fixtures/render-null/astro.config.mjs +0 -7
- package/test/fixtures/render-null/markdoc.config.mjs +0 -26
- package/test/fixtures/render-null/node_modules/.bin/astro +0 -17
- package/test/fixtures/render-null/package.json +0 -9
- package/test/fixtures/render-null/src/content/blog/render-null.mdoc +0 -7
- package/test/fixtures/render-null/src/pages/index.astro +0 -19
- package/test/fixtures/render-simple/astro.config.mjs +0 -7
- package/test/fixtures/render-simple/node_modules/.bin/astro +0 -17
- package/test/fixtures/render-simple/package.json +0 -9
- package/test/fixtures/render-simple/src/content/blog/simple.mdoc +0 -7
- package/test/fixtures/render-simple/src/pages/index.astro +0 -19
- package/test/fixtures/render-with-components/astro.config.mjs +0 -7
- package/test/fixtures/render-with-components/markdoc.config.mjs +0 -28
- package/test/fixtures/render-with-components/node_modules/.bin/astro +0 -17
- package/test/fixtures/render-with-components/package.json +0 -12
- package/test/fixtures/render-with-components/src/components/Code.astro +0 -12
- package/test/fixtures/render-with-components/src/components/CustomMarquee.astro +0 -1
- package/test/fixtures/render-with-components/src/content/blog/with-components.mdoc +0 -17
- package/test/fixtures/render-with-components/src/pages/index.astro +0 -19
- package/test/fixtures/render-with-config/astro.config.mjs +0 -7
- package/test/fixtures/render-with-config/markdoc.config.mjs +0 -15
- package/test/fixtures/render-with-config/node_modules/.bin/astro +0 -17
- package/test/fixtures/render-with-config/package.json +0 -9
- package/test/fixtures/render-with-config/src/content/blog/with-config.mdoc +0 -13
- package/test/fixtures/render-with-config/src/pages/index.astro +0 -19
- package/test/image-assets.test.js +0 -76
- package/test/render.test.js +0 -150
- package/tsconfig.json +0 -10
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from 'astro:content';
|
|
3
|
-
|
|
4
|
-
const entry = await getEntryBySlug('blog', 'entry');
|
|
5
|
-
const { Content } = await entry.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<html lang="en">
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="utf-8" />
|
|
11
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
12
|
-
<meta name="viewport" content="width=device-width" />
|
|
13
|
-
<meta name="generator" content={Astro.generator} />
|
|
14
|
-
<title>Astro</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -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
|
|
Binary file
|
|
Binary file
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from 'astro:content';
|
|
3
|
-
|
|
4
|
-
const intro = await getEntryBySlug('docs', 'intro');
|
|
5
|
-
const { Content } = await intro.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<html lang="en">
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="utf-8" />
|
|
11
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
12
|
-
<meta name="viewport" content="width=device-width" />
|
|
13
|
-
<meta name="generator" content={Astro.generator} />
|
|
14
|
-
<title>Astro</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
|
2
|
-
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
|
3
|
-
<style>
|
|
4
|
-
path { fill: #000; }
|
|
5
|
-
@media (prefers-color-scheme: dark) {
|
|
6
|
-
path { fill: #FFF; }
|
|
7
|
-
}
|
|
8
|
-
</style>
|
|
9
|
-
</svg>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
|
|
2
|
-
|
|
3
|
-
export default defineMarkdocConfig({
|
|
4
|
-
nodes: {
|
|
5
|
-
document: {
|
|
6
|
-
render: null,
|
|
7
|
-
|
|
8
|
-
// Defaults from `Markdoc.nodes.document`
|
|
9
|
-
children: [
|
|
10
|
-
'heading',
|
|
11
|
-
'paragraph',
|
|
12
|
-
'image',
|
|
13
|
-
'table',
|
|
14
|
-
'tag',
|
|
15
|
-
'fence',
|
|
16
|
-
'blockquote',
|
|
17
|
-
'comment',
|
|
18
|
-
'list',
|
|
19
|
-
'hr',
|
|
20
|
-
],
|
|
21
|
-
attributes: {
|
|
22
|
-
frontmatter: { render: false },
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from "astro:content";
|
|
3
|
-
|
|
4
|
-
const post = await getEntryBySlug('blog', 'render-null');
|
|
5
|
-
const { Content } = await post.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!DOCTYPE html>
|
|
9
|
-
<html lang="en">
|
|
10
|
-
<head>
|
|
11
|
-
<meta charset="UTF-8">
|
|
12
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14
|
-
<title>Content</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from "astro:content";
|
|
3
|
-
|
|
4
|
-
const post = await getEntryBySlug('blog', 'simple');
|
|
5
|
-
const { Content } = await post.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!DOCTYPE html>
|
|
9
|
-
<html lang="en">
|
|
10
|
-
<head>
|
|
11
|
-
<meta charset="UTF-8">
|
|
12
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14
|
-
<title>Content</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import Code from './src/components/Code.astro';
|
|
2
|
-
import CustomMarquee from './src/components/CustomMarquee.astro';
|
|
3
|
-
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
|
|
4
|
-
|
|
5
|
-
export default defineMarkdocConfig({
|
|
6
|
-
nodes: {
|
|
7
|
-
fence: {
|
|
8
|
-
render: Code,
|
|
9
|
-
attributes: {
|
|
10
|
-
language: { type: String },
|
|
11
|
-
content: { type: String },
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
tags: {
|
|
16
|
-
mq: {
|
|
17
|
-
render: CustomMarquee,
|
|
18
|
-
attributes: {
|
|
19
|
-
direction: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: 'left',
|
|
22
|
-
matches: ['left', 'right', 'up', 'down'],
|
|
23
|
-
errorLevel: 'critical',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
})
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
<marquee data-custom-marquee {...Astro.props}><slot /></marquee>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Post with components
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## Post with components
|
|
6
|
-
|
|
7
|
-
This uses a custom marquee component with a shortcode:
|
|
8
|
-
|
|
9
|
-
{% mq direction="right" %}
|
|
10
|
-
I'm a marquee too!
|
|
11
|
-
{% /mq %}
|
|
12
|
-
|
|
13
|
-
And a code component for code blocks:
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
const isRenderedWithShiki = true;
|
|
17
|
-
```
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from "astro:content";
|
|
3
|
-
|
|
4
|
-
const post = await getEntryBySlug('blog', 'with-components');
|
|
5
|
-
const { Content } = await post.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!DOCTYPE html>
|
|
9
|
-
<html lang="en">
|
|
10
|
-
<head>
|
|
11
|
-
<meta charset="UTF-8">
|
|
12
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14
|
-
<title>Content</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
|
|
2
|
-
|
|
3
|
-
export default defineMarkdocConfig({
|
|
4
|
-
variables: {
|
|
5
|
-
countries: ['ES', 'JP'],
|
|
6
|
-
},
|
|
7
|
-
functions: {
|
|
8
|
-
includes: {
|
|
9
|
-
transform(parameters) {
|
|
10
|
-
const [array, value] = Object.values(parameters);
|
|
11
|
-
return Array.isArray(array) ? array.includes(value) : false;
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
})
|
|
@@ -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,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Post with config
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## Post with config
|
|
6
|
-
|
|
7
|
-
{% if includes($countries, "EN") %} Hello {% /if %}
|
|
8
|
-
{% if includes($countries, "ES") %} Hola {% /if %}
|
|
9
|
-
{% if includes($countries, "JP") %} Konnichiwa {% /if %}
|
|
10
|
-
|
|
11
|
-
## Runtime variables
|
|
12
|
-
|
|
13
|
-
{% $runtimeVariable %} {% #runtime-variable %}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { getEntryBySlug } from "astro:content";
|
|
3
|
-
|
|
4
|
-
const post = await getEntryBySlug('blog', 'with-config');
|
|
5
|
-
const { Content } = await post.render();
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!DOCTYPE html>
|
|
9
|
-
<html lang="en">
|
|
10
|
-
<head>
|
|
11
|
-
<meta charset="UTF-8">
|
|
12
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14
|
-
<title>Content</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<Content runtimeVariable="working!" />
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { parseHTML } from 'linkedom';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { loadFixture } from '../../../astro/test/test-utils.js';
|
|
4
|
-
|
|
5
|
-
const root = new URL('./fixtures/image-assets/', import.meta.url);
|
|
6
|
-
|
|
7
|
-
describe('Markdoc - Image assets', () => {
|
|
8
|
-
let baseFixture;
|
|
9
|
-
|
|
10
|
-
before(async () => {
|
|
11
|
-
baseFixture = await loadFixture({
|
|
12
|
-
root,
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('dev', () => {
|
|
17
|
-
let devServer;
|
|
18
|
-
|
|
19
|
-
before(async () => {
|
|
20
|
-
devServer = await baseFixture.startDevServer();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
after(async () => {
|
|
24
|
-
await devServer.stop();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('uses public/ image paths unchanged', async () => {
|
|
28
|
-
const res = await baseFixture.fetch('/');
|
|
29
|
-
const html = await res.text();
|
|
30
|
-
const { document } = parseHTML(html);
|
|
31
|
-
expect(document.querySelector('#public > img')?.src).to.equal('/favicon.svg');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('transforms relative image paths to optimized path', async () => {
|
|
35
|
-
const res = await baseFixture.fetch('/');
|
|
36
|
-
const html = await res.text();
|
|
37
|
-
const { document } = parseHTML(html);
|
|
38
|
-
expect(document.querySelector('#relative > img')?.src).to.equal(
|
|
39
|
-
'/_image?href=%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&f=webp'
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('transforms aliased image paths to optimized path', async () => {
|
|
44
|
-
const res = await baseFixture.fetch('/');
|
|
45
|
-
const html = await res.text();
|
|
46
|
-
const { document } = parseHTML(html);
|
|
47
|
-
expect(document.querySelector('#alias > img')?.src).to.equal(
|
|
48
|
-
'/_image?href=%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp'
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('build', () => {
|
|
54
|
-
before(async () => {
|
|
55
|
-
await baseFixture.build();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('uses public/ image paths unchanged', async () => {
|
|
59
|
-
const html = await baseFixture.readFile('/index.html');
|
|
60
|
-
const { document } = parseHTML(html);
|
|
61
|
-
expect(document.querySelector('#public > img')?.src).to.equal('/favicon.svg');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('transforms relative image paths to optimized path', async () => {
|
|
65
|
-
const html = await baseFixture.readFile('/index.html');
|
|
66
|
-
const { document } = parseHTML(html);
|
|
67
|
-
expect(document.querySelector('#relative > img')?.src).to.match(/^\/_astro\/oar.*\.webp$/);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('transforms aliased image paths to optimized path', async () => {
|
|
71
|
-
const html = await baseFixture.readFile('/index.html');
|
|
72
|
-
const { document } = parseHTML(html);
|
|
73
|
-
expect(document.querySelector('#alias > img')?.src).to.match(/^\/_astro\/cityscape.*\.webp$/);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|