Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing newline bug in mdx #4145

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.