Skip to content

Commit 580f57c

Browse files
feat: add code highlighting to descriptions in the new editor (freeCodeCamp#43740)
1 parent b0d48b8 commit 580f57c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

client/src/templates/Challenges/classic/editor.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
Range as RangeType
88
// eslint-disable-next-line import/no-duplicates
99
} from 'monaco-editor/esm/vs/editor/editor.api';
10+
import { highlightAllUnder } from 'prismjs';
1011
import React, {
1112
useEffect,
1213
Suspense,
@@ -450,6 +451,7 @@ const Editor = (props: EditorProps): JSX.Element => {
450451
descContainer.appendChild(jawHeading);
451452
descContainer.appendChild(desc);
452453
desc.innerHTML = description;
454+
highlightAllUnder(desc);
453455
// TODO: the solution is probably just to use an overlay that's forced to
454456
// follow the decorations.
455457
// TODO: this is enough for Firefox, but Chrome needs more before the

0 commit comments

Comments
 (0)