feat(test): add jump to question functionality

This commit is contained in:
shafin-r
2026-01-29 18:30:55 +06:00
parent 5df438f474
commit 57f27ed399
6 changed files with 184 additions and 24 deletions

View File

@ -0,0 +1,19 @@
import { BlockMath, InlineMath } from "react-katex";
export const renderQuestionText = (text: string) => {
const parts = text.split(/(\$\$.*?\$\$|\$.*?\$)/g);
return (
<>
{parts.map((part, index) => {
if (part.startsWith("$$")) {
return <BlockMath key={index}>{part.slice(2, -2)}</BlockMath>;
}
if (part.startsWith("$")) {
return <InlineMath key={index}>{part.slice(1, -1)}</InlineMath>;
}
return <span key={index}>{part}</span>;
})}
</>
);
};