Skip to content

Commit

Permalink
fix(highlight-code): fix regression code highlight behavior
Browse files Browse the repository at this point in the history
Refs #7603
  • Loading branch information
char0n committed Nov 5, 2021
1 parent 7443b2e commit 7cc2657
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/components/highlight-code.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"

const HighlightCode = ({value, fileName, className, downloadable, getConfigs, canCopy, language}) => {
const config = isFunction(getConfigs) ? getConfigs() : null
const canSyntaxHighlight = get(config, "syntaxHighlight.activated", true)
const highlighterStyle = getStyle(get(config, "syntaxHighlight.theme", "agate"))
const canSyntaxHighlight = get(config, "syntaxHighlight") !== false && get(config, "syntaxHighlight.activated", true)
const rootRef = useRef(null)

useEffect(() => {
Expand Down Expand Up @@ -62,11 +61,11 @@ const HighlightCode = ({value, fileName, className, downloadable, getConfigs, ca
? <SyntaxHighlighter
language={language}
className={cx(className, "microlight")}
style={highlighterStyle}
style={getStyle(get(config, "syntaxHighlight.theme", "agate"))}
>
{value}
</SyntaxHighlighter>
: <pre className={cx(className + "microlight")}>{value}</pre>
: <pre className={cx(className, "microlight")}>{value}</pre>
}

</div>
Expand Down

0 comments on commit 7cc2657

Please sign in to comment.