Skip to content

Commit 77e3adb

Browse files
authored
[SeaORM] fix: remove redundant prism-core import that breaks code formatting on logo hover (#167) (#168)
The HomepageExample.js files in SeaORM, SeaQuery, SeaStreamer, and SeaORM-X imported a standalone prism-core instance and set it as window.Prism at module scope. When Docusaurus prefetched the homepage bundle (triggered by hovering over the navbar logo), this module-level code executed and overwrote the global Prism instance, corrupting syntax highlighting on the current page. Since Rust grammar is already registered via docusaurus.config.js (additionalLanguages: ['toml', 'rust', 'bash']), these manual imports were redundant and harmful. Removing them fixes the issue. Closes #167
1 parent daacf26 commit 77e3adb

File tree

4 files changed

+0
-12
lines changed

4 files changed

+0
-12
lines changed

SeaORM-X/src/components/HomepageExample.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import { Highlight, themes } from "prism-react-renderer";
77
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
88
import { useColorMode } from '@docusaurus/theme-common';
99

10-
import Prism from 'prismjs/components/prism-core';
11-
(typeof global !== "undefined" ? global : window).Prism = Prism;
12-
require("prismjs/components/prism-rust");
1310

1411
const codeBlocks = [
1512
{

SeaORM/src/components/HomepageExample.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import { Highlight, themes } from "prism-react-renderer";
77
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
88
import { useColorMode } from '@docusaurus/theme-common';
99

10-
import Prism from 'prismjs/components/prism-core';
11-
(typeof global !== "undefined" ? global : window).Prism = Prism;
12-
require("prismjs/components/prism-rust");
1310

1411
const codeBlocks = [
1512
{

SeaQuery/src/components/HomepageExample.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import { Highlight, themes } from "prism-react-renderer";
77
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
88
import { useColorMode } from '@docusaurus/theme-common';
99

10-
import Prism from 'prismjs/components/prism-core';
11-
(typeof global !== "undefined" ? global : window).Prism = Prism;
12-
require("prismjs/components/prism-rust");
1310

1411
const codeBlocks = [
1512
{

SeaStreamer/src/components/HomepageExample.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import { Highlight, themes } from "prism-react-renderer";
77
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
88
import { useColorMode } from '@docusaurus/theme-common';
99

10-
import Prism from 'prismjs/components/prism-core';
11-
(typeof global !== "undefined" ? global : window).Prism = Prism;
12-
require("prismjs/components/prism-rust");
1310

1411
const codeBlocks = [
1512
{

0 commit comments

Comments
 (0)