diffs

Use when an app uses @pierre/diffs to render or edit code files, diffs, patches, merge conflicts, or CodeView review surfaces, including React, vanilla JavaScript, SSR, workers, annotations, selection, and custom Shiki languages or themes.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/diffs'
Download bundle ↓
main · 1831817Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Highlighting API

This reference lists every language, theme, shared highlighter, and stream export from @pierre/diffs.

Contents

Shiki passthrough APIs

ExportKindPurpose
codeToHtmlFunctionRe-exports Shiki's complete code-to-HTML helper.
createCSSVariablesThemeFunctionRe-exports Shiki's CSS variable theme factory.

Language APIs

ExportKindPurpose
registerCustomLanguageFunctionRegisters a lazy language and optional file mappings.
resolveLanguageFunctionLoads and caches one language registration.
resolveLanguagesFunctionLoads and caches several language registrations.
getResolvedOrResolveLanguageFunctionReturns one cached language or starts its load.
getResolvedLanguagesFunctionGets cached registrations for the supplied languages.
hasResolvedLanguagesFunctionTests whether language registrations are cached.
attachResolvedLanguagesFunctionAdds resolved registrations to a highlighter.
areLanguagesAttachedFunctionTests whether a highlighter has the supplied languages.
cleanUpResolvedLanguagesFunctionClears language resolution state.
RegisteredCustomLanguagesMapStores registered custom language loaders.
ResolvedLanguagesMapStores resolved language registrations.
ResolvingLanguagesMapStores active language load promises.
AttachedLanguagesSetStores language names attached to the shared highlighter.

Theme APIs

ExportKindPurpose
registerCustomThemeFunctionRegisters a lazy Shiki theme loader.
CustomThemeLoaderTypeDefines a raw or resolved Shiki theme loader.
registerCustomCSSVariableThemeFunctionRegisters a theme that reads CSS variables.
resolveThemeFunctionLoads and caches one theme.
resolveThemesFunctionLoads and caches several themes.
getResolvedOrResolveThemeFunctionReturns one cached theme or starts its load.
getResolvedThemesFunctionGets cached themes by name.
hasResolvedThemesFunctionTests whether themes are cached.
attachResolvedThemesFunctionAdds resolved themes to a highlighter.
areThemesAttachedFunctionTests whether a highlighter has the supplied themes.
cleanUpResolvedThemesFunctionClears theme resolution state.
AttachedThemesSetStores theme names attached to the shared highlighter.

Shared highlighter APIs

ExportPurpose
getSharedHighlighterGets or creates the shared highlighter for themes and languages.
preloadHighlighterLoads the shared highlighter before a render.
getHighlighterIfLoadedGets the shared highlighter after load.
isHighlighterLoadedTests a highlighter cache value for a loaded instance.
isHighlighterLoadingTests a highlighter cache value for an active promise.
isHighlighterNullTests a highlighter cache value for an empty state.
disposeHighlighterDisposes and clears the shared highlighter.
getHighlighterOptionsConverts one language and component options to highlighter input.
getHighlighterThemeStylesCreates theme CSS from a loaded highlighter.
getThemesConverts one theme or light/dark pair to a name list.
isWorkerContextTests whether code runs in a worker global scope.

Render APIs

ExportPurpose
renderFileWithHighlighterCreates a highlighted file syntax tree.
renderDiffWithHighlighterCreates highlighted deletion and addition syntax trees.
createTransformerWithStateCreates Shiki transformers with shared render state.

Stream APIs

ExportKindPurpose
FileStreamClassRenders a readable code stream as highlighted rows.
FileStreamOptionsTypeConfigures stream language, theme, start line, and callbacks.
CodeToTokenTransformStreamClassConverts code chunks to themed or recall tokens.
CodeToTokenTransformStreamOptionsTypeConfigures stream tokenization and recall tokens.
ShikiStreamTokenizerClassTracks stable and unstable tokens across code chunks.
ShikiStreamTokenizerOptionsTypeSupplies Shiki token options and a highlighter.
ShikiStreamTokenizerEnqueueResultTypeReturns recalled, stable, and unstable tokens for one chunk.
RecallTokenTypeRequests removal of prior unstable tokens.

FileStream members

MemberPurpose
new FileStream(options?)Creates a stream renderer.
setup(source, wrapper)Connects a readable code stream to a host.
setThemeType(themeType)Selects system, light, or dark theme mode.
cleanUp()Aborts the stream and releases resources.

ShikiStreamTokenizer members

MemberPurpose
new ShikiStreamTokenizer(options)Creates a stateful tokenizer.
enqueue(chunk)Tokenizes one code chunk.
close()Finalizes and returns stable tokens.
clear()Clears accumulated token state.
clone()Copies current tokenizer state.

CodeToTokenTransformStream exposes its tokenizer and options values.

Referenced from SKILL.md