Skip to content

Special characters may break onclick #418

@LuisHeinzlmeier

Description

@LuisHeinzlmeier

If I render this question, it does not respond to my clicks. The multiple-choice question may not work correctly if the explanation text contains quotes or special characters (').

multiple_choice_question(
    question_id="q4",
    question="How would you access RNA data in a MuData object `mdata`?",
    options=[
        "mdata.rna",
        "mdata.obs['rna']",
        "mdata.mod['rna']",
        "mdata.uns['rna']",
    ],
    correct_answer="mdata.mod['rna']",
    explanations={
        "mdata.rna": "MuData does not provide direct attributes for modalities. They are stored in `mod`.",
        "mdata.obs['rna']": "`obs` stores cell-level metadata, not modality data.",
        "mdata.uns['rna']": "`uns` stores unstructured metadata, not the modality matrix.",
    },
)

LLM suggested sth like this:

import html
explanation_text_escaped = html.escape(explanation_text)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions