Skip to content

Commit

Permalink
Merge pull request #21 from sudaraka94/fix-java-syntax-highlighting
Browse files Browse the repository at this point in the history
Fix Java syntax highlighting πŸš€
  • Loading branch information
sudaraka94 authored Apr 30, 2024
2 parents f4cfb42 + c556083 commit 0389cff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Code/Code.Prism.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Highlight, defaultProps, Language, themes } from 'prism-react-renderer'
import { Highlight, themes, Prism } from 'prism-react-renderer'
import styled from "@emotion/styled";
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";

Expand Down Expand Up @@ -42,8 +42,14 @@ const Copy: React.FC<CopyProps> = ({ toCopy }) => {

const RE = /{([\d,-]+)}/;

const loadCustomLanguages = () => {
(typeof global !== "undefined" ? global : window).Prism = Prism
require("prismjs/components/prism-java")
}


const CodePrism: React.FC = (props) => {
loadCustomLanguages();
const { props: { className, children: codeString, metastring } } = props.children;
if (props["live"]) {
return (
Expand Down

0 comments on commit 0389cff

Please sign in to comment.