Thank you for your interest in contributing to mathprog-editor! This guide will help you get started.
-
Clone the repository
git clone https://github.com/jonra/MathProg.git cd mathprog-editor -
Install dependencies
npm install
-
Generate the parser
npm run grammar
-
Build the project
npm run build
-
Run tests
npm test -
Start the dev server
npm run dev
Then open
demo/index.htmlin your browser.
src/language/— Lezer grammar, tokenizer, syntax highlighting, autocompletesrc/brackets/— Rainbow brackets, scope highlighting, mismatch detectionsrc/math-render/— MathProg-to-LaTeX converter, KaTeX renderer, side panelsrc/lint/— Error detection with human-friendly messagessrc/theme/— Light and dark editor themessrc/index.ts— Main exports and conveniencemathProgEditor()functiondemo/— Interactive demo pagetest/— Test suite
- Use the GitHub issue tracker
- Include the MathProg code that triggers the bug
- Describe expected vs. actual behavior
- Include browser/OS info if relevant
- Open a discussion or issue describing the use case
- Explain why existing features don't cover your need
- Fork the repo and create a feature branch from
main - Write tests for new functionality
- Ensure all tests pass:
npm test - Ensure the build succeeds:
npm run build - Write clear commit messages
- Open a PR with a description of the changes
The Lezer grammar (src/language/mathprog.grammar) is the foundation of the editor. Changes here affect everything downstream. When modifying the grammar:
- Run
npm run grammarto regenerate the parser - Verify the grammar test suite passes
- Test with real MathProg/GMPL models in the demo page
- Check that highlighting, autocomplete, and linting still work
- TypeScript with strict mode
- No unnecessary abstractions — keep it simple
- Follow existing patterns in the codebase
By contributing, you agree that your contributions will be licensed under the MIT License.