Skip to content
Merged
6 changes: 6 additions & 0 deletions .changeset/satteri-0-10-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/markdown-satteri': patch
'@astrojs/mdx': patch
---

Updates Sätteri processor to v0.10.3. See [its changelog](https://github.com/bruits/satteri/blob/main/packages/satteri/CHANGELOG.md#0103--2026-08-19) for details on bugs fixed and features added.
2 changes: 1 addition & 1 deletion packages/integrations/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"remark-math": "^6.0.0",
"remark-rehype": "^11.1.2",
"remark-toc": "^9.0.0",
"satteri": "^0.9.1",
"satteri": "^0.10.3",
"shiki": "^4.0.2",
"unified": "^11.0.5",
"vite": "^8.0.13"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('collect images', async () => {
visit(tree, 'element', (node) => {
if (node.tagName === 'img') {
node.properties.className = ['image-class'];
node.properties.htmlFor = 'some-id';
node.properties.htmlFor = ['some-id'];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a weird thing with @types/hast latest update, unrelated to Sätteri (apart from Sätteri bringing it on), strings are clearly supported (this code works), however the types claim to only support arrays.

}
});
};
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/remark/test/shiki.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('shiki syntax highlighting', () => {
const root = hast.children[0] as Element;

assert.match(root.properties.class as string, /astro-code github-dark/);
assert.match(root.properties.style as string, /background-color:#24292e;color:#e1e4e8;/);
assert.match(root.properties.style!, /background-color:#24292e;color:#e1e4e8;/);
});

it('createShikiHighlighter can reuse the same instance for different languages', async () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/markdown/satteri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"@astrojs/internal-helpers": "workspace:*",
"@astrojs/prism": "workspace:*",
"github-slugger": "^2.0.0",
"hast-util-from-html": "^2.0.3",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

"satteri": "^0.9.1"
"satteri": "^0.10.3"
},
"devDependencies": {
"astro-scripts": "workspace:*"
Expand Down
5 changes: 3 additions & 2 deletions packages/markdown/satteri/src/satteri-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ export async function createHighlightFn(

if (syntaxHighlightType === 'prism') {
const { runHighlighterWithAstro } = await import('@astrojs/prism/dist/highlighter');
const { fromHtml } = await import('hast-util-from-html');
const { htmlToHast } = await loadSatteri();
return async (code, lang) => {
const { html, classLanguage } = await runHighlighterWithAstro(lang, code);
const pre = `<pre class="${classLanguage}" data-language="${lang}"><code class="${classLanguage}">${html}</code></pre>`;
return fromHtml(pre, { fragment: true }).children[0] as HastNode;
const tree = htmlToHast(pre, { fragment: true });
return ('children' in tree ? tree.children[0] : undefined) as HastNode;

@Princesseuh Princesseuh Aug 18, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type Sätteri returns here is less accurate, but it's breaking now so I'll have to wait for 0.11.0 to fix it, it's this issue bruits/satteri#191

};
}

Expand Down
Loading
Loading