10000 chore(twoslash)!: fix highlight typos by jxom · Pull Request #102 · antfu/shikiji · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

chore(twoslash)!: fix highlight typos #102

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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