forked from laptou/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Markdown + Components usage (withastro#3410)
* feat: use internal MDX tooling for markdown + components * fix: improve MD + component tests * chore: add changeset * fix: make tsc happy * fix(withastro#3319): add regression test for component children * fix(markdown): support HTML comments in markdown * fix(withastro#2474): ensure namespaced components are properly handled in markdown pages * fix(withastro#3220): ensure html in markdown pages does not have extra surrounding space * fix(withastro#3264): ensure that remark files pass in file information * fix(withastro#3254): enable experimentalStaticExtraction for `.md` pages * fix: revert parsing change * fix: remove `markdown.mode` option
- Loading branch information
1 parent
e938280
commit 688a3cd
Showing
14 changed files
with
131 additions
and
16 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { h } from 'preact'; | ||
|
||
const TextBlock = ({ | ||
title, | ||
children, | ||
noPadding = false, | ||
}) => { | ||
return ( | ||
<div | ||
className={`${ | ||
noPadding ? "" : "md:px-2 lg:px-4" | ||
} flex-1 prose prose-headings:font-grotesk`} | ||
> | ||
<h3>{title}</h3> | ||
<p>{children}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TextBlock; |
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,5 @@ | ||
import Counter from './Counter'; | ||
|
||
export default { | ||
Counter | ||
} |
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,3 @@ | ||
This should have `nospace` around it. | ||
|
||
This should have <code class="custom-class">nospace</code> around it. |
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 @@ | ||
--- | ||
setup: import TextBlock from '../components/TextBlock' | ||
--- | ||
{/* https://github.com/withastro/astro/issues/3319 */} | ||
|
||
<TextBlock title="Hello world!" noPadding> | ||
<ul class="not-prose"> | ||
<li>A</li> | ||
<li>B</li> | ||
<li>C</li> | ||
</ul> | ||
</TextBlock> |
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,7 @@ | ||
--- | ||
const content = await Astro.glob('../content/*.md'); | ||
--- | ||
|
||
<div> | ||
{content.map(({ Content }) => <Content />)} | ||
</div> |
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,2 @@ | ||
<!-- HTML comments! --> | ||
# It works! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
setup: import ns from '../components/index.js'; | ||
--- | ||
|
||
# Hello Namespace! | ||
|
||
<ns.Counter>Click me!</ns.Counter> |
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,7 @@ | ||
# Test | ||
|
||
## Let's try a script... | ||
|
||
This should work! | ||
|
||
<script src="/src/scripts/test.js" /> |
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,7 @@ | ||
--- | ||
title: My Blog Post | ||
--- | ||
|
||
# {frontmatter.title} | ||
|
||
Hello world |
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 @@ | ||
console.log("Hello world"); |