mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Co-authored-by: Kelvin Soh <kelvinsoh@pop-os.localdomain> Co-authored-by: Fred K. Schott <fkschott@gmail.com>
This commit is contained in:
parent
9cf2df81db
commit
09b2f0e470
4 changed files with 22 additions and 0 deletions
5
.changeset/thirty-clouds-end.md
Normal file
5
.changeset/thirty-clouds-end.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fix passing Markdown content through props (#1259)
|
|
@ -810,6 +810,7 @@ async function compileHtml(enterNode: TemplateNode, state: CodegenState, compile
|
|||
async leave(node, parent, prop, index) {
|
||||
switch (node.type) {
|
||||
case 'Fragment': {
|
||||
if (curr === 'markdown') curr = 'out';
|
||||
buffers[curr] += `)`;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -128,4 +128,14 @@ Markdown('Can render markdown with --- for horizontal rule', async ({ runtime })
|
|||
// It works!
|
||||
});
|
||||
|
||||
Markdown('Can render markdown content prop (#1259)', async ({ runtime }) => {
|
||||
const result = await runtime.load('/content');
|
||||
assert.ok(!result.error, `build error: ${result.error}`);
|
||||
|
||||
const $ = doc(result.contents);
|
||||
assert.equal($('h1').text(), 'Foo', 'Markdown rendered correctly via content prop');
|
||||
|
||||
// It works!
|
||||
});
|
||||
|
||||
Markdown.run();
|
||||
|
|
6
packages/astro/test/fixtures/astro-markdown/src/pages/content.astro
vendored
Normal file
6
packages/astro/test/fixtures/astro-markdown/src/pages/content.astro
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
import { Markdown } from 'astro/components';
|
||||
const content = '# Foo';
|
||||
---
|
||||
|
||||
<Markdown content={content} />
|
Loading…
Reference in a new issue