shiki hljs
This commit is contained in:
parent
b5d0d81363
commit
8229b2c310
3 changed files with 7 additions and 5 deletions
|
|
@ -16,9 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { cl } from "@plugins/shikiCodeblocks.desktop/utils/misc";
|
||||
import { cl, hljs } from "@plugins/shikiCodeblocks.desktop/utils/misc";
|
||||
import type { IThemedToken } from "@vap/shiki";
|
||||
import { hljs } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
||||
import { ThemeBase } from "./Highlighter";
|
||||
|
|
|
|||
|
|
@ -20,10 +20,15 @@ import { resolveLang } from "@plugins/shikiCodeblocks.desktop/api/languages";
|
|||
import { HighlighterProps } from "@plugins/shikiCodeblocks.desktop/components/Highlighter";
|
||||
import { HljsSetting } from "@plugins/shikiCodeblocks.desktop/types";
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import { hljs } from "@webpack/common";
|
||||
import { DefaultExtractAndLoadChunksRegex, extractAndLoadChunks, findByPropsLazy, proxyLazyWebpack } from "@webpack";
|
||||
|
||||
export const cl = classNameFactory("vc-shiki-");
|
||||
|
||||
export const hljs: typeof import("highlight.js").default = proxyLazyWebpack(() => {
|
||||
extractAndLoadChunks(["codeBlock:{react("], new RegExp(`*hljs*.+?${DefaultExtractAndLoadChunksRegex.source}`));
|
||||
return findByPropsLazy("highlight", "registerLanguage");
|
||||
});
|
||||
|
||||
export const shouldUseHljs = ({
|
||||
lang,
|
||||
tryHljs,
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ export const Constants: t.Constants = mapMangledModuleLazy('ME:"/users/@me"', {
|
|||
export const RestAPI: t.RestAPI = findLazy(m => typeof m === "object" && m.del && m.put);
|
||||
export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYear");
|
||||
|
||||
export const hljs: typeof import("highlight.js").default = findLazy(m => m.default?.highlight && m.default?.registerLanguage)?.default;
|
||||
|
||||
export const useDrag = findByCodeLazy("useDrag::spec.begin was deprecated");
|
||||
// you cant make a better finder i love that they remove display names sm
|
||||
export const useDrop = findByCodeLazy(".disconnectDropTarget()", ".dropTargetOptions=");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue