Skip to content

Commit

Permalink
chore(twoslash)!: fix highlight typos (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom authored Jan 17, 2024
1 parent 3f25cfb commit b8c4c88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/shikiji-twoslash/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function createTransformerFactory(
break
}
case 'highlight': {
if (renderer.nodesHightlight) {
if (renderer.nodesHighlight) {
actionsHighlights.push(() => {
const line = this.lines[node.line]
let charIndex = 0
Expand All @@ -230,8 +230,8 @@ export function createTransformerFactory(

const targets = line.children.slice(itemStart, itemEnd)
const length = targets.length
const hightlighted = renderer.nodesHightlight?.call(this, node, targets) || targets
line.children.splice(itemStart, length, ...hightlighted)
const highlighted = renderer.nodesHighlight?.call(this, node, targets) || targets
line.children.splice(itemStart, length, ...highlighted)
})
}
break
Expand Down
8 changes: 4 additions & 4 deletions packages/shikiji-twoslash/src/renderer-rich.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere
jsdoc = true,
} = options

function hightlightPopupContent(
function highlightPopupContent(
codeToHast: ShikijiTransformerContextCommon['codeToHast'],
shikijiOptions: ShikijiTransformerContextCommon['options'],
info: { text?: string, docs?: string },
Expand Down Expand Up @@ -116,7 +116,7 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere

return {
nodeStaticInfo(info, node) {
const themedContent = hightlightPopupContent(this.codeToHast, this.options, info)
const themedContent = highlightPopupContent(this.codeToHast, this.options, info)

if (!themedContent.length)
return node
Expand Down Expand Up @@ -145,7 +145,7 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere
if (!query.text)
return {}

const themedContent = hightlightPopupContent(this.codeToHast, this.options, query)
const themedContent = highlightPopupContent(this.codeToHast, this.options, query)

return {
type: 'element',
Expand Down Expand Up @@ -327,7 +327,7 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere
]
},

nodesHightlight(highlight, nodes) {
nodesHighlight(highlight, nodes) {
return [
{
type: 'element',
Expand Down
2 changes: 1 addition & 1 deletion packages/shikiji-twoslash/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ export interface TwoslashRenderer {
nodeQuery?(this: ShikijiTransformerContext, query: NodeQuery, node: Element | Text): Partial<ElementContent>
nodeCompletion?(this: ShikijiTransformerContext, query: NodeCompletion, node: Element | Text): Partial<ElementContent>

nodesHightlight?(this: ShikijiTransformerContext, highlight: NodeHighlight, nodes: ElementContent[]): ElementContent[]
nodesHighlight?(this: ShikijiTransformerContext, highlight: NodeHighlight, nodes: ElementContent[]): ElementContent[]
}

0 comments on commit b8c4c88

Please sign in to comment.