diff --git a/.changeset/large-berries-grow.md b/.changeset/large-berries-grow.md
new file mode 100644
index 000000000..81589045d
--- /dev/null
+++ b/.changeset/large-berries-grow.md
@@ -0,0 +1,6 @@
+---
+'astro': patch
+'@astrojs/markdown-remark': patch
+---
+
+Fix components in markdown regressions
diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js
index e5daa1b46..b001c6a83 100644
--- a/packages/astro/test/astro-markdown.test.js
+++ b/packages/astro/test/astro-markdown.test.js
@@ -82,7 +82,6 @@ describe('Astro Markdown', () => {
// https://github.com/withastro/astro/issues/3254
it('Can handle scripts in markdown pages', async () => {
const html = await fixture.readFile('/script/index.html');
- console.log(html);
expect(html).not.to.match(new RegExp('/src/scripts/test.js'));
});
@@ -273,4 +272,42 @@ describe('Astro Markdown', () => {
expect($('code').eq(2).text()).to.contain('title: import.meta.env.TITLE');
expect($('blockquote').text()).to.contain('import.meta.env.TITLE');
});
+
+ it('Escapes HTML tags in code blocks', async () => {
+ const html = await fixture.readFile('/code-in-md/index.html');
+ const $ = cheerio.load(html);
+
+ expect($('code').eq(0).html()).to.equal('<script>');
+ expect($('blockquote').length).to.equal(1);
+ expect($('code').eq(1).html()).to.equal('</script>');
+ expect($('pre').html()).to.contain('>This should also work without any problems.<');
+ });
+
+ it('Allows defining slot contents in component children', async () => {
+ const html = await fixture.readFile('/slots/index.html');
+ const $ = cheerio.load(html);
+
+ const slots = $('article').eq(0);
+ expect(slots.find('> .fragmentSlot > div').text()).to.contain('1:');
+ expect(slots.find('> .fragmentSlot > div + p').text()).to.contain('2:');
+ expect(slots.find('> .pSlot > p[title="hello"]').text()).to.contain('3:');
+ expect(slots.find('> .defaultSlot').text().replace(/\s+/g, ' ')).to.equal(`
+ 4: Div in default slot
+ 5: Paragraph in fragment in default slot
+ 6: Regular text in default slot
+ `.replace(/\s+/g, ' '));
+
+ const nestedSlots = $('article').eq(1);
+ expect(nestedSlots.find('> .fragmentSlot').html()).to.contain('1:');
+ expect(nestedSlots.find('> .pSlot > p').text()).to.contain('2:');
+ expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal(`
+ 3: nested fragmentSlot
+ 4: nested pSlot
+ 5: nested text in default slot
+ `.replace(/\s+/g, ' '));
+
+ expect($('article').eq(3).text().replace(/[^❌]/g, '')).to.equal('❌❌❌');
+
+ expect($('article').eq(4).text().replace(/[^❌]/g, '')).to.equal('❌❌❌');
+ });
});
diff --git a/packages/astro/test/fixtures/astro-markdown/src/components/SlotComponent.astro b/packages/astro/test/fixtures/astro-markdown/src/components/SlotComponent.astro
new file mode 100644
index 000000000..f0aa9fc1c
--- /dev/null
+++ b/packages/astro/test/fixtures/astro-markdown/src/components/SlotComponent.astro
@@ -0,0 +1,13 @@
+
2: Paragraph in fragmentSlot
+5: Paragraph in fragment in default slot
3: p with title as pSlot
+2: pSlot
+4: nested pSlot
+ 5: nested text in default slot +