Skip to content

Commit 6c9f941

Browse files
fix: Prism.tokenize only takes two arguments (no language argument)
For more information see the following links: https://prismjs.com/docs/Prism.html#.tokenize https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/prismjs/index.d.ts#L135
1 parent 4d80194 commit 6c9f941

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ declare module "prism-react-renderer" {
4545
languages: LanguageDict;
4646
tokenize: (
4747
code: string,
48-
grammar: PrismGrammar,
49-
language: Language
48+
grammar: PrismGrammar
5049
) => PrismToken[] | string[];
5150
highlight: (
5251
code: string,

src/components/Highlight.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,7 @@ class Highlight extends Component<Props, *> {
137137
};
138138

139139
Prism.hooks.run("before-tokenize", env);
140-
const tokens = (env.tokens = Prism.tokenize(
141-
env.code,
142-
env.grammar,
143-
env.language
144-
));
140+
const tokens = (env.tokens = Prism.tokenize(env.code, env.grammar));
145141
Prism.hooks.run("after-tokenize", env);
146142

147143
return tokens;

src/types.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ export type Token = {
2727

2828
export type PrismLib = {
2929
languages: LanguagesDict,
30-
tokenize: (
31-
code: string,
32-
grammar: PrismGrammar,
33-
language: Language
34-
) => Array<PrismToken | string>,
30+
tokenize: (code: string, grammar: PrismGrammar) => Array<PrismToken | string>,
3531
highlight: (
3632
code: string,
3733
grammar: PrismGrammar,

0 commit comments

Comments
 (0)