diff options
-rw-r--r-- | .changeset/good-beers-worry.md | 5 | ||||
-rw-r--r-- | docs/reference/api-reference.md | 5 | ||||
-rw-r--r-- | packages/markdown-support/src/index.ts | 2 |
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(), }; } |