;
hasDemo: boolean;
toolPanel: ReactNode;
- superBlock: SuperBlocks;
tests: Test[];
}
export function SidePanel({
- block,
challengeDescription,
challengeTitle,
instructionsPanelRef,
hasDemo,
toolPanel,
- superBlock,
tests,
openModal
}: SidePanelProps): JSX.Element {
- useEffect(() => {
- const mathJaxChallenge =
- superBlock === SuperBlocks.RosettaCode ||
- superBlock === SuperBlocks.ProjectEuler ||
- block === 'intermediate-algorithm-scripting';
- initializeMathJax(mathJaxChallenge);
- }, [block, superBlock]);
-
return (
-
+
)}
@@ -239,7 +242,10 @@ const ShowGeneric = ({
{instructions && (
-
+
)}
diff --git a/client/src/templates/Challenges/ms-trophy/show.tsx b/client/src/templates/Challenges/ms-trophy/show.tsx
index 56997a2f49b..4ee7cdf940b 100644
--- a/client/src/templates/Challenges/ms-trophy/show.tsx
+++ b/client/src/templates/Challenges/ms-trophy/show.tsx
@@ -184,6 +184,7 @@ function MsTrophy(props: MsTrophyProps) {
{title}
diff --git a/client/src/templates/Challenges/projects/backend/show.tsx b/client/src/templates/Challenges/projects/backend/show.tsx
index bb565d79be9..ed053d076b5 100644
--- a/client/src/templates/Challenges/projects/backend/show.tsx
+++ b/client/src/templates/Challenges/projects/backend/show.tsx
@@ -189,6 +189,7 @@ const ShowBackEnd = (props: BackEndProps) => {
{title}
diff --git a/client/src/templates/Challenges/projects/frontend/show.tsx b/client/src/templates/Challenges/projects/frontend/show.tsx
index 88ad872d870..f27ee706d7d 100644
--- a/client/src/templates/Challenges/projects/frontend/show.tsx
+++ b/client/src/templates/Challenges/projects/frontend/show.tsx
@@ -158,6 +158,7 @@ const ShowFrontEndProject = (props: ProjectProps) => {
{title}
diff --git a/client/src/templates/Challenges/quiz/show.tsx b/client/src/templates/Challenges/quiz/show.tsx
index cf6b180f330..098612c6c99 100644
--- a/client/src/templates/Challenges/quiz/show.tsx
+++ b/client/src/templates/Challenges/quiz/show.tsx
@@ -313,7 +313,10 @@ const ShowQuiz = ({
-
+
diff --git a/client/src/utils/math-jax.ts b/client/src/utils/math-jax.ts
index b97ea11bffc..b537b017b4d 100644
--- a/client/src/utils/math-jax.ts
+++ b/client/src/utils/math-jax.ts
@@ -1,15 +1,19 @@
+import { SuperBlocks } from '../../../shared/config/curriculum';
import { scriptLoader } from './script-loaders';
export const mathJaxSrc =
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML';
export const isMathJaxAllowed = (pathname: string) =>
- [
- '/learn/javascript-algorithms-and-data-structures-v8',
- '/learn/project-euler/',
- '/learn/rosetta-code',
- '/learn/scientific-computing-with-python'
- ].some(allowedPath => pathname.includes(allowedPath));
+ superBlocksWithMathJax.some(superBlock => pathname.includes(superBlock));
+
+const superBlocksWithMathJax = [
+ SuperBlocks.JsAlgoDataStructNew,
+ SuperBlocks.JsAlgoDataStruct,
+ SuperBlocks.ProjectEuler,
+ SuperBlocks.RosettaCode,
+ SuperBlocks.SciCompPy
+];
const configure = () => {
if (!global.MathJax) return;
@@ -21,17 +25,13 @@ const configure = () => {
['\\(', '\\)']
],
processEscapes: true,
- processClass:
- 'rosetta-code|project-euler|intermediate-algorithm-scripting|description-container'
+ processClass: 'mathjax-support'
}
});
MathJax.Hub.Queue([
'Typeset',
MathJax.Hub,
- document.querySelector('.intermediate-algorithm-scripting'),
- document.querySelector('.rosetta-code'),
- document.querySelector('.project-euler'),
- document.querySelector('.description-container')
+ document.querySelector('.mathjax-support')
]);
};
diff --git a/client/utils/tags.tsx b/client/utils/tags.tsx
index a130cd72e52..4f1d9c9814a 100644
--- a/client/utils/tags.tsx
+++ b/client/utils/tags.tsx
@@ -44,7 +44,7 @@ export function getheadTagComponents(): JSX.Element[] {
return headTags;
}
-export function getPostBodyComponents(pathname: string): JSX.Element[] {
+export function getPostBodyComponents(superblock: string): JSX.Element[] {
const scripts = [];
const mathJaxScriptElement = (
);
- if (isMathJaxAllowed(pathname)) {
+ if (isMathJaxAllowed(superblock)) {
scripts.push(mathJaxScriptElement);
}