Skip to content

Commit

Permalink
fix missing newline bug in mdx (#4145)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored Aug 5, 2022
1 parent 3321aac commit c7efcf5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shaggy-beds-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/mdx': patch
---

Fix a missing newline bug when `layout` was set.
2 changes: 1 addition & 1 deletion packages/integrations/mdx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit c7efcf5

Please sign in to comment.