Skip to content

Commit

Permalink
fix: recover subscript support for options (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
PupoSDC authored Feb 15, 2024
1 parent 955c784 commit df24403
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
10 changes: 8 additions & 2 deletions libs/core/markdown/src/common/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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: <MarkdownFromServer children={opt.text} />,
}))}
annexesHref={annexes.map((annex) => annex.href)}
onOptionClicked={(optionId) => {
setSelectedOption(optionId);
Expand Down
2 changes: 1 addition & 1 deletion libs/next/tests/src/containers/test-exam/test-exam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const TestExam = container<Props>(
}
options={question.options.map((opt) => ({
id: opt.id,
text: opt.text,
text: <MarkdownFromServer children={opt.text} />,
}))}
annexesHref={question.annexes}
onAnnexClicked={(annex) => setCurrentAnnex(annex)}
Expand Down
2 changes: 1 addition & 1 deletion libs/next/tests/src/containers/test-study/test-study.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const TestStudy = container<Props>(
}
options={question.options.map((opt) => ({
id: opt.id,
text: opt.text,
text: <MarkdownFromServer children={opt.text} />,
}))}
annexesHref={question.annexes}
onAnnexClicked={(annex) => setCurrentAnnex(annex)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit df24403

Please sign in to comment.