fix missing newline bug in mdx (#4145)
This commit is contained in:
parent
3321aace06
commit
c7efcf57e0
3 changed files with 9 additions and 1 deletions
5
.changeset/shaggy-beds-itch.md
Normal file
5
.changeset/shaggy-beds-itch.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/mdx': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix a missing newline bug when `layout` was set.
|
|
@ -99,7 +99,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration {
|
||||||
const frontmatter = getFrontmatter(code, id);
|
const frontmatter = getFrontmatter(code, id);
|
||||||
if (frontmatter.layout) {
|
if (frontmatter.layout) {
|
||||||
const { layout, ...content } = frontmatter;
|
const { layout, ...content } = frontmatter;
|
||||||
code += `\nexport default async function({ children }) {\nconst Layout = (await import(${JSON.stringify(
|
code += `\n\nexport default async function({ children }) {\nconst Layout = (await import(${JSON.stringify(
|
||||||
frontmatter.layout
|
frontmatter.layout
|
||||||
)})).default;\nconst frontmatter=${JSON.stringify(
|
)})).default;\nconst frontmatter=${JSON.stringify(
|
||||||
content
|
content
|
||||||
|
|
|
@ -5,3 +5,6 @@ illThrowIfIDontExist: "Oh no, that's scary!"
|
||||||
---
|
---
|
||||||
|
|
||||||
{frontmatter.illThrowIfIDontExist}
|
{frontmatter.illThrowIfIDontExist}
|
||||||
|
|
||||||
|
> Note: newline intentionally missing from the end of this file.
|
||||||
|
> Useful since that can be the source of bugs in our compile step.
|
Loading…
Reference in a new issue