@sridharvn/question-generator
v0.1.0
Published
TypeScript library for generating and rendering math questions with MathJax support.
Maintainers
Readme
@sridharvn/question-generator
TypeScript library for generating and rendering math questions across 6 topics and 3 difficulty levels, with built-in MathJax support.
Installation
npm install @sridharvn/question-generatorQuick Start
import { generateQuestion, renderQuestion } from '@sridharvn/question-generator'
const entry = generateQuestion('arithmetic', 'easy')
const output = renderQuestion(entry, 'raw')
console.log(output.question)
console.log(output.steps)
console.log(output.finalAnswer)API
generateQuestion(topic, difficulty)
Returns a single MathQuestionEntry with both raw and mathjax content blocks.
renderQuestion(entry, mode)
Converts a MathQuestionEntry into a flat MathQuestionOutput using one of these render modes:
rawmathjax-dollarmathjax-bracket
createQuestionGenerator(options?)
Creates a scoped generator with:
getQuestion(callOpts?)getQuestions(count, callOpts?)getPresets(callOpts?)
Topics
arithmeticalgebrageometryfractionscalculusstatistics
Difficulties
easymediumhard
License
MIT
