From df244037d3f2b43c6d111b2a2974664c2c85aa51 Mon Sep 17 00:00:00 2001 From: PupoSDC Date: Thu, 15 Feb 2024 06:39:36 +0000 Subject: [PATCH] fix: recover subscript support for options (#169) Fix https://github.com/PupoSDC/chair-flight/issues/168 image --- libs/core/markdown/src/common/plugins.ts | 10 ++++++++-- .../question-stand-alone/question-stand-alone.tsx | 5 ++++- libs/next/tests/src/containers/test-exam/test-exam.tsx | 2 +- .../tests/src/containers/test-study/test-study.tsx | 2 +- .../question-multiple-choice.tsx | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/core/markdown/src/common/plugins.ts b/libs/core/markdown/src/common/plugins.ts index 0ef3f4097..1f824db32 100644 --- a/libs/core/markdown/src/common/plugins.ts +++ b/libs/core/markdown/src/common/plugins.ts @@ -3,8 +3,14 @@ import { default as remarkGemoji } from "remark-gemoji"; import { default as remarkGfm } from "remark-gfm"; import { default as remarkMath } from "remark-math"; import { default as remarkSupersub } from "remark-supersub"; +import type { PluggableList } from "@mdx-js/mdx/lib/core"; export const markdownPlugins = { - remarkPlugins: [remarkGfm, remarkMath, remarkGemoji, remarkSupersub], - rehypePlugins: [rehypeKatex], + remarkPlugins: [ + [remarkGfm, { singleTilde: false }], + remarkMath, + remarkGemoji, + remarkSupersub, + ] as PluggableList, + rehypePlugins: [rehypeKatex] as PluggableList, }; diff --git a/libs/next/question-bank/src/containers/question-stand-alone/question-stand-alone.tsx b/libs/next/question-bank/src/containers/question-stand-alone/question-stand-alone.tsx index 132a17384..62e28d37b 100644 --- a/libs/next/question-bank/src/containers/question-stand-alone/question-stand-alone.tsx +++ b/libs/next/question-bank/src/containers/question-stand-alone/question-stand-alone.tsx @@ -58,7 +58,10 @@ export const QuestionStandAloneComponent: FunctionComponent< selectedOptionId={selectedOption} status={selectedStatus} disabled={selectedStatus === "show-result"} - options={question.options} + options={question.options.map((opt) => ({ + ...opt, + text: , + }))} annexesHref={annexes.map((annex) => annex.href)} onOptionClicked={(optionId) => { setSelectedOption(optionId); diff --git a/libs/next/tests/src/containers/test-exam/test-exam.tsx b/libs/next/tests/src/containers/test-exam/test-exam.tsx index 56fbfab40..a71f8b80f 100644 --- a/libs/next/tests/src/containers/test-exam/test-exam.tsx +++ b/libs/next/tests/src/containers/test-exam/test-exam.tsx @@ -168,7 +168,7 @@ export const TestExam = container( } options={question.options.map((opt) => ({ id: opt.id, - text: opt.text, + text: , }))} annexesHref={question.annexes} onAnnexClicked={(annex) => setCurrentAnnex(annex)} diff --git a/libs/next/tests/src/containers/test-study/test-study.tsx b/libs/next/tests/src/containers/test-study/test-study.tsx index 099e5cc57..2adf2ab86 100644 --- a/libs/next/tests/src/containers/test-study/test-study.tsx +++ b/libs/next/tests/src/containers/test-study/test-study.tsx @@ -220,7 +220,7 @@ export const TestStudy = container( } options={question.options.map((opt) => ({ id: opt.id, - text: opt.text, + text: , }))} annexesHref={question.annexes} onAnnexClicked={(annex) => setCurrentAnnex(annex)} diff --git a/libs/react/components/src/question-multiple-choice/question-multiple-choice.tsx b/libs/react/components/src/question-multiple-choice/question-multiple-choice.tsx index b12179762..80f729db7 100644 --- a/libs/react/components/src/question-multiple-choice/question-multiple-choice.tsx +++ b/libs/react/components/src/question-multiple-choice/question-multiple-choice.tsx @@ -80,7 +80,7 @@ export type QuestionMultipleChoiceStatus = "in-progress" | "show-result"; export type QuestionMultipleChoiceProps = { question?: ReactNode; - options?: Array<{ id: string; text: string }>; + options?: Array<{ id: string; text: ReactNode }>; status?: QuestionMultipleChoiceStatus; correctOptionId?: string; selectedOptionId?: string;