mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
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: '',
|
description: '',
|
||||||
**/
|
**/
|
||||||
astro: {
|
astro: {
|
||||||
headers: [], // TODO: document what this means
|
headers: [], // an array of h1...h6 elements in the markdown file
|
||||||
source: '' // raw source of the markdown file
|
source: '' // raw source of the markdown file
|
||||||
|
html: '' // rendered HTML of the markdown file
|
||||||
},
|
},
|
||||||
url: '' // the rendered path
|
url: '' // the rendered path
|
||||||
}[]
|
}[]
|
||||||
|
|
|
@ -68,7 +68,7 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
astro: { headers, source: content },
|
astro: { headers, source: content, html: result.toString() },
|
||||||
content: result.toString(),
|
content: result.toString(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue