minyeamer commented on code in PR #66809:
URL: https://github.com/apache/airflow/pull/66809#discussion_r3238775003
##########
airflow-core/src/airflow/ui/src/utils/syntaxHighlighter.ts:
##########
@@ -16,20 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
-import bash from "react-syntax-highlighter/dist/esm/languages/prism/bash";
-import json from "react-syntax-highlighter/dist/esm/languages/prism/json";
-import python from "react-syntax-highlighter/dist/esm/languages/prism/python";
-import sql from "react-syntax-highlighter/dist/esm/languages/prism/sql";
-import yaml from "react-syntax-highlighter/dist/esm/languages/prism/yaml";
+import type { CSSProperties } from "react";
-// Register all supported languages once
-SyntaxHighlighter.registerLanguage("python", python);
-SyntaxHighlighter.registerLanguage("json", json);
-SyntaxHighlighter.registerLanguage("yaml", yaml);
-SyntaxHighlighter.registerLanguage("sql", sql);
-SyntaxHighlighter.registerLanguage("bash", bash);
+export {
+ atomOneDark as oneDark,
+ atomOneLight as oneLight,
+} from "react-syntax-highlighter/dist/esm/styles/hljs";
-export { oneDark, oneLight } from
"react-syntax-highlighter/dist/esm/styles/prism";
+export { default as SyntaxHighlighter } from "react-syntax-highlighter";
-export { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
Review Comment:
I initially switched to the default export based on a GitHub Copilot
suggestion to support a wider range of languages without manual registration.
I hadn't fully considered the impact on bundle size at the time. Please let
me know your preference, and I will revert this to `PrismLight` with selective
registration if needed.
capture:
<img width="779" height="636" alt="image"
src="https://github.com/user-attachments/assets/dc96488c-b072-4ab4-8613-c527f490d6fc"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]