qcm-parser
v3.2.0
Published
Parse Markdown-formatted QCM into JSON.
Maintainers
Readme
qcm-parser
A lightweight TypeScript/JavaScript library to parse Markdown-style QCM (Multiple-Choice Questionnaires) into JSON.
📦 Installation
Using npm:
npm install qcm-parserUsing yarn:
yarn add qcm-parserQuickstart for usage

Output

Markdown example file
Check the qcm-example.md file to see the format required
📖 API
parseQCM(markdown: string, options?: ParseOptions): Question[]
markdown (string) A Markdown-formatted string in which questions are prefixed with ## Q: and answers with - [ ] or - [x].
options (ParseOptions, optional)
🔧 Configuration
By default, parseQCM will detect if a question has multiple correct answers and set multipleAnswers: true. If you want to force single-answer mode (QCU), pass:
const questions = parseQCM(markdown, { enforceSingle: true });An error will be thrown if any question contains more than one [x].
MIT © EmmanuelWill
