Expose content.astro.html to Astro.fetchContent (#583)

* feat: expose `content.astro.html` to Astro.fetchContent

* docs: add `astro.html` note to docs
This commit is contained in:
Nate Moore 2021-07-01 12:07:26 -05:00 committed by GitHub
parent d3969436dc
commit f83407e09a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/markdown-support': patch
---
Expose `html` to `Astro.fetchContent` (#571)

View file

@ -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
}[]

View file

@ -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(),
};
}