@@ -11,7 +11,7 @@ import { DiffUnifiedView } from "./DiffUnifiedView";
1111import { DiffViewContext } from "./DiffViewContext" ;
1212import { createDiffConfigStore } from "./tools" ;
1313
14- import type { DiffHighlighterLang } from "@git-diff-view/core" ;
14+ import type { DiffHighlighter , DiffHighlighterLang } from "@git-diff-view/core" ;
1515
1616_cacheMap . name = "@git-diff-view/cli" ;
1717
@@ -26,6 +26,7 @@ export type DiffViewProps = {
2626 diffFile ?: DiffFile ;
2727 diffViewMode ?: DiffModeEnum ;
2828 diffViewTheme ?: "light" | "dark" ;
29+ registerHighlighter ?: Omit < DiffHighlighter , "getHighlighterEngine" > ;
2930 diffViewHighlight ?: boolean ;
3031} ;
3132
@@ -102,7 +103,7 @@ const InternalDiffView = (
102103const MemoedInternalDiffView = memo ( InternalDiffView ) ;
103104
104105const DiffViewWithRef = ( props : DiffViewProps ) => {
105- const { data, diffViewTheme, diffFile : _diffFile , ...restProps } = props ;
106+ const { registerHighlighter , data, diffViewTheme, diffFile : _diffFile , ...restProps } = props ;
106107
107108 const diffFile = useMemo ( ( ) => {
108109 if ( _diffFile ) {
@@ -155,10 +156,10 @@ const DiffViewWithRef = (props: DiffViewProps) => {
155156 useEffect ( ( ) => {
156157 if ( ! diffFile ) return ;
157158 if ( props . diffViewHighlight ) {
158- diffFile . initSyntax ( ) ;
159- diffFile . notifyAll ( ) ;
159+ diffFile . initSyntax ( { registerHighlighter : registerHighlighter } ) ;
160160 }
161- } , [ diffFile , props . diffViewHighlight , props . diffViewTheme ] ) ;
161+ diffFile . notifyAll ( ) ;
162+ } , [ diffFile , props . diffViewHighlight , props . diffViewTheme , registerHighlighter ] ) ;
162163
163164 // fix react strict mode error
164165 useUnmount ( ( ) => ( __DEV__ ? diffFile ?. _destroy ?.( ) : diffFile ?. clear ?.( ) ) , [ diffFile ] ) ;
0 commit comments