Repository navigation
feat(satteri): update to Sätteri 0.10.x #17731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b320d0e
e8c545c
f13d26f
e264c8e
1acd068
6bbf554
ce51dd9
b079a9b
6154204
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,7 @@ | |
| "@astrojs/internal-helpers": "workspace:*", | ||
| "@astrojs/prism": "workspace:*", | ||
| "github-slugger": "^2.0.0", | ||
| "hast-util-from-html": "^2.0.3", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yay
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
| "satteri": "^0.9.1" | ||
| "satteri": "^0.10.3" | ||
| }, | ||
| "devDependencies": { | ||
| "astro-scripts": "workspace:*" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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.