Skip to content

Commit 1ef01c2

Browse files
committed
fixup!
1 parent 1a61b74 commit 1ef01c2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/core/src/utils/type-annotations

‎packages/core/src/utils/type-annotations/hast.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import { highlighter } from '../highlighter.mjs';
44

5+
const [lightTheme, darkTheme] = highlighter.shiki.getLoadedThemes();
6+
57
/**
68
* Slices a type's text by its resolved link ranges into hast children —
79
* plain text segments interleaved with `<a class="type-link">` anchors.
@@ -80,7 +82,7 @@ export const typeAnnotationToHighlightedHast = (state, node) => {
8082

8183
const root = highlighter.shiki.codeToHast(node.value, {
8284
lang: 'typescript',
83-
theme: highlighter.shiki.getLoadedThemes()[0],
85+
themes: { light: lightTheme, dark: darkTheme },
8486
decorations: links.map(({ start, end, href }) => ({
8587
start,
8688
end,
@@ -92,8 +94,7 @@ export const typeAnnotationToHighlightedHast = (state, node) => {
9294

9395
// codeToHast wraps the highlighted line in <pre><code>; re-shape that into
9496
// a single inline <code> element ("only the outermost type opens/closes
95-
// the code fragment") carrying Shiki's theme styling. The <pre>'s tabindex
96-
// is dropped — an inline fragment is no scroll container.
97+
// the code fragment")
9798
const [preElement] = root.children;
9899
const [codeElement] = preElement.children;
99100

@@ -102,7 +103,6 @@ export const typeAnnotationToHighlightedHast = (state, node) => {
102103
tagName: 'code',
103104
properties: {
104105
class: `${preElement.properties.class} type`,
105-
style: preElement.properties.style,
106106
},
107107
children: codeElement.children,
108108
};

0 commit comments

Comments
 (0)