fix missing newline bug in mdx (#4145)

This commit is contained in:
Fred K. Schott 2022-08-04 23:12:07 -07:00 committed by GitHub
parent 3321aace06
commit c7efcf57e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/mdx': patch
---
Fix a missing newline bug when `layout` was set.

View file

@ -99,7 +99,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration {
const frontmatter = getFrontmatter(code, id);
if (frontmatter.layout) {
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
)})).default;\nconst frontmatter=${JSON.stringify(
content

View file

@ -5,3 +5,6 @@ illThrowIfIDontExist: "Oh no, that's scary!"
---
{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.