summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2021-07-01 12:07:26 -0500
committerGravatar GitHub <noreply@github.com> 2021-07-01 12:07:26 -0500
commitf83407e09a204a4e892f431637fe186e3e988a65 (patch)
treefba69f5e9ae49b9bb1b65134e87c847d6fe76d6c
parentd3969436dcbe40a3d41a036ff7c2761aed176109 (diff)
downloadastro-f83407e09a204a4e892f431637fe186e3e988a65.tar.gz
astro-f83407e09a204a4e892f431637fe186e3e988a65.tar.zst
astro-f83407e09a204a4e892f431637fe186e3e988a65.zip
Expose `content.astro.html` to `Astro.fetchContent` (#583)
* feat: expose `content.astro.html` to Astro.fetchContent * docs: add `astro.html` note to docs
-rw-r--r--.changeset/good-beers-worry.md5
-rw-r--r--docs/reference/api-reference.md5
-rw-r--r--packages/markdown-support/src/index.ts2
3 files changed, 9 insertions, 3 deletions
diff --git a/.changeset/good-beers-worry.md b/.changeset/good-beers-worry.md
new file mode 100644
index 000000000..d81a24a0f
--- /dev/null
+++ b/.changeset/good-beers-worry.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/markdown-support': patch
+---
+
+Expose `html` to `Astro.fetchContent` (#571)
diff --git a/docs/reference/api-reference.md b/docs/reference/api-reference.md
index e7f605901..0f04682bf 100644
--- a/docs/reference/api-reference.md
+++ b/docs/reference/api-reference.md
@@ -41,8 +41,9 @@ const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of po
description: '',
**/
astro: {
- headers: [], // TODO: document what this means
- source: '' // raw source of the markdown file
+ headers: [], // an array of h1...h6 elements in the markdown file
+ source: '' // raw source of the markdown file
+ html: '' // rendered HTML of the markdown file
},
url: '' // the rendered path
}[]
diff --git a/packages/markdown-support/src/index.ts b/packages/markdown-support/src/index.ts
index f311efa7c..f3ceda1a1 100644
--- a/packages/markdown-support/src/index.ts
+++ b/packages/markdown-support/src/index.ts
@@ -68,7 +68,7 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp
}
return {
- astro: { headers, source: content },
+ astro: { headers, source: content, html: result.toString() },
content: result.toString(),
};
}