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:
parent
d3969436dc
commit
f83407e09a
3 changed files with 9 additions and 3 deletions
5
.changeset/good-beers-worry.md
Normal file
5
.changeset/good-beers-worry.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/markdown-support': patch
|
||||
---
|
||||
|
||||
Expose `html` to `Astro.fetchContent` (#571)
|
|
@ -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
|
||||
}[]
|
||||
|
|
|
@ -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(),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue