diff --git a/src/content/docs/en/guides/integrations-guide/cloudflare.mdx b/src/content/docs/en/guides/integrations-guide/cloudflare.mdx
index af8c90f79a88d..b938087f110b1 100644
--- a/src/content/docs/en/guides/integrations-guide/cloudflare.mdx
+++ b/src/content/docs/en/guides/integrations-guide/cloudflare.mdx
@@ -391,12 +391,12 @@ All module types export a single default value. Modules can be imported both fro
The following is an example of importing a Wasm module that then responds to requests by adding the request's number parameters together.
-```js title="pages/add/[a]/[b].js"
+```js title="src/pages/add/[a]/[b].js"
// Import the WebAssembly module
import mod from '../util/add.wasm';
// Instantiate first in order to use it
-const addModule: any = new WebAssembly.Instance(mod);
+const addModule = new WebAssembly.Instance(mod);
export async function GET(context) {
const a = Number.parseInt(context.params.a);
diff --git a/src/content/docs/en/guides/integrations-guide/markdoc.mdx b/src/content/docs/en/guides/integrations-guide/markdoc.mdx
index 0b0545eccdbd0..b5102c0913c39 100644
--- a/src/content/docs/en/guides/integrations-guide/markdoc.mdx
+++ b/src/content/docs/en/guides/integrations-guide/markdoc.mdx
@@ -117,9 +117,12 @@ Then, [query and display your posts and collections](/en/guides/content-collecti
```astro title="src/pages/why-markdoc.astro"
---
-import { getEntry, render } from 'astro:content';
+import { getEntry, render } from "astro:content";
-const entry = await getEntry('docs', 'why-markdoc');
+const entry = await getEntry("docs", "why-markdoc");
+if (!entry) {
+ throw new Error("Entry not found");
+}
const { Content } = await render(entry);
---
@@ -142,6 +145,9 @@ Variables can be passed as props via the `Content` component:
import { getEntry, render } from 'astro:content';
const entry = await getEntry('docs', 'why-markdoc');
+if (!entry) {
+ throw new Error("Entry not found");
+}
const { Content } = await render(entry);
---
@@ -180,6 +186,9 @@ To access frontmatter, you can pass the entry `data` property as a variable wher
import { getEntry, render } from 'astro:content';
const entry = await getEntry('docs', 'why-markdoc');
+if (!entry) {
+ throw new Error("Entry not found");
+}
const { Content } = await render(entry);
---
@@ -499,9 +508,16 @@ The following steps will create a custom Markdoc image tag to display a `
-
- {caption && {caption}}
+ {
+ typeof src === "string" ? (
+
+ ) : (
+
+ )
+ }
+ {caption && {caption}}
```
diff --git a/src/content/docs/en/guides/integrations-guide/mdx.mdx b/src/content/docs/en/guides/integrations-guide/mdx.mdx
index ef8ef9e936b3e..0be0e356fbdd4 100644
--- a/src/content/docs/en/guides/integrations-guide/mdx.mdx
+++ b/src/content/docs/en/guides/integrations-guide/mdx.mdx
@@ -133,11 +133,11 @@ Or you can use that exported `title` in your page using `import` and `import.met
```astro title="src/pages/index.astro"
---
-const matches = import.meta.glob('./posts/*.mdx', { eager: true });
+const matches = import.meta.glob("./posts/*.mdx", { eager: true });
const posts = Object.values(matches);
---
-{posts.map(post =>
{post.title}
)}
+{posts.map((post: any) =>
{post.title}
)}
```
#### Exported Properties
@@ -240,11 +240,15 @@ The following example passes a custom heading to the `` component via
```astro title="src/pages/blog/post-1.astro" ins="components={{ h1: CustomHeading }}"
---
-import { getEntry, render } from 'astro:content';
-import CustomHeading from '../../components/CustomHeading.astro';
-const entry = await getEntry('blog', 'post-1');
+import { getEntry, render } from "astro:content";
+import CustomHeading from "../../components/CustomHeading.astro";
+const entry = await getEntry("blog", "post-1");
+if (!entry) {
+ throw new Error("Entry not found");
+}
const { Content } = await render(entry);
---
+
```
@@ -358,20 +362,22 @@ For example, say you need a different syntax highlighter and a different set of
```js title="astro.config.mjs"
import { defineConfig } from 'astro/config';
-import { satteri } from '@astrojs/markdown-satteri';
-import mdx from '@astrojs/mdx';
+import { satteri } from "@astrojs/markdown-satteri";
+import mdx from "@astrojs/mdx";
+import mdastPlugin1 from "./src/mdast-plugin-1";
+import mdastPlugin2 from "./src/mdast-plugin-2";
export default defineConfig({
// ...
markdown: {
- syntaxHighlight: 'prism',
+ syntaxHighlight: "prism",
processor: satteri({ mdastPlugins: [mdastPlugin1] }),
},
integrations: [
mdx({
// Markdown `syntaxHighlight` overridden,
// `.mdx` files use Shiki instead.
- syntaxHighlight: 'shiki',
+ syntaxHighlight: "shiki",
// `markdown.processor` gets overridden for `.mdx` files by this option
processor: satteri({ mdastPlugins: [mdastPlugin2] }),
@@ -384,8 +390,9 @@ You may also need to disable `markdown` config extension in MDX. For this, set `
```js title="astro.config.mjs"
import { defineConfig } from 'astro/config';
-import { satteri } from '@astrojs/markdown-satteri';
-import mdx from '@astrojs/mdx';
+import { satteri } from "@astrojs/markdown-satteri";
+import mdx from "@astrojs/mdx";
+import mdastPlugin from "./src/mdast-plugin";
export default defineConfig({
// ...
@@ -466,10 +473,10 @@ You will need to exclude these components from optimization as the optimizer eag
For example, the intended MDX output of the following is `...` in place of every `"
...
"`:
-```astro
+```astro title="src/pages/any-page.astro"
---
-import { Content, components } from '../content.mdx';
-import Heading from '../Heading.astro';
+import { Content, components } from "../content.mdx";
+import Heading from "../components/Heading.astro";
---
diff --git a/src/content/docs/en/guides/integrations-guide/partytown.mdx b/src/content/docs/en/guides/integrations-guide/partytown.mdx
index 3b9cc3a32b79f..39721f0a89f13 100644
--- a/src/content/docs/en/guides/integrations-guide/partytown.mdx
+++ b/src/content/docs/en/guides/integrations-guide/partytown.mdx
@@ -154,7 +154,10 @@ export default defineConfig({
Some third-party scripts may require [proxying](https://partytown.qwik.dev/proxying-requests/) through `config.resolveUrl()`, which runs inside the service worker. You can set this configuration option to check for a specific URL, and optionally return a proxied URL instead:
-```js title="astro.config.mjs" {7-13}
+```js title="astro.config.mjs" {10-15}
+import { defineConfig } from 'astro/config';
+import partytown from "@astrojs/partytown";
+
export default defineConfig({
// ...
integrations: [
@@ -162,13 +165,12 @@ export default defineConfig({
// Example: proxy Facebook's analytics script
config: {
resolveUrl: (url) => {
- const proxyMap = {
- "connect.facebook.net": "my-proxy.com"
- }
- url.hostname = proxyMap[url.hostname] || url.hostname;
+ const proxyMap = new Map([["connect.facebook.net", "my-proxy.com"]]);
+ const proxiedHost = proxyMap.get(url.hostname);
+ if (proxiedHost) url.hostname = proxiedHost;
return url;
},
- }
+ },
}),
],
});