-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent body head content injection in MDX when using layout (#6779)
- Loading branch information
Showing
7 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/mdx': patch | ||
--- | ||
|
||
Prevent body head content injection in MDX when using layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/BasicBlock.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
const { inlineStyle, title, display = 'horizontal' } = Astro.props; | ||
const lineEnding = display === 'horizontal' ? ', ' : '<br>'; | ||
--- | ||
|
||
{title && <h2 set:html={title} />} | ||
<address style={inlineStyle}> | ||
<span class="name">some name</span><Fragment set:html={lineEnding} /> | ||
line 1<Fragment set:html={lineEnding} /> | ||
line 2<Fragment set:html={lineEnding} /> | ||
line 3<Fragment set:html={lineEnding} /> | ||
line 4<Fragment set:html={lineEnding} /> | ||
line 5 | ||
</address> |
15 changes: 15 additions & 0 deletions
15
packages/integrations/mdx/test/fixtures/css-head-mdx/src/layouts/DocumentLayout.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
// Extend the BaseLayout, adding space for a banner at the top of the page | ||
// after the main heading, then the detail for the actual page | ||
import ContentLayout from './ContentLayout.astro'; | ||
const { frontmatter } = Astro.props; | ||
--- | ||
|
||
<ContentLayout> | ||
<div class="content-container"> | ||
<article id="main-content" class="pad-z5 flow"> | ||
<h1 set:html={frontmatter.pageHeading ? frontmatter.pageHeading : frontmatter.title} /> | ||
<slot /> | ||
</article> | ||
</div> | ||
</ContentLayout> |
12 changes: 12 additions & 0 deletions
12
...ges/integrations/mdx/test/fixtures/css-head-mdx/src/pages/componentwithtext.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: ../layouts/DocumentLayout.astro | ||
title: blah blah | ||
--- | ||
|
||
import BasicBlock from '../components/BasicBlock.astro'; | ||
|
||
Some text for a paragraph. | ||
|
||
<BasicBlock title="This causes css in wrong place." /> | ||
|
||
Some other text. |