-
Notifications
You must be signed in to change notification settings - Fork 4
fix(#45): add math support #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit implements complete solutions for all items in issue #45: 1. **Arithmatex Support (NEW)**: Implemented full PyMdown Extensions Arithmatex support for LaTeX/math expressions - Inline math: $...$ (smart dollar mode) and \(...\) - Block math: $$...$$, \[...\], and \begin{env}...\end{env} - Smart dollar mode prevents false positives (e.g., $3.00) - Comprehensive test coverage with 6 new test cases 2. ** Entity Replacement (DOCUMENTED)**: Added documentation explaining that conversion to Unicode is core mdformat behavior - Added "Known Behaviors" section to README - Documented CSS alternatives for spacing (padding, margin, gap, etc.) - Updated test fixture comments to explain behavior 3. **Attribute Lists (COMPLETED)**: Already fixed in previous commits - Attribute lists preserved when using --wrap mode - Updated outdated FIXME comments to accurate descriptions - All tests passing (165/165) Changes: - Added mdformat_mkdocs/mdit_plugins/_pymd_arithmatex.py - Added tests/format/fixtures/pymd_arithmatex.md - Updated README.md with Arithmatex support and Known Behaviors section - Updated plugin.py to register Arithmatex plugin - Updated test fixtures to remove outdated FIXME comments - All tests passing (165 passed, +6 new Arithmatex tests) Resolves #45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements complete solutions for issue #45 by adding Arithmatex (math/LaTeX) support, documenting entity replacement behavior, and updating outdated comments about attribute lists.
- Added full PyMdown Extensions Arithmatex support for inline and block math expressions
- Documented known behavior regarding HTML entity conversion to Unicode
- Updated test fixtures to replace outdated FIXME comments with accurate descriptions
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mdformat_mkdocs/mdit_plugins/_pymd_arithmatex.py | New plugin implementing Arithmatex math expression parsing with inline ( |
| tests/format/fixtures/pymd_arithmatex.md | New test fixtures covering 6 test cases for inline math, block math with various delimiters, and mixed math expressions |
| mdformat_mkdocs/mdit_plugins/init.py | Export new Arithmatex constants and plugin function |
| mdformat_mkdocs/plugin.py | Register Arithmatex plugin and renderers for inline and block math nodes |
| tests/format/test_format.py | Add pymd_arithmatex.md to test fixtures list |
| tests/render/fixtures/python_markdown_attr_list.md | Update comments from "FIXME" to "Note" explaining conversion behavior |
| tests/format/fixtures/python_markdown_attr_list.md | Update comments from "FIXME" to "Note" explaining conversion behavior |
| README.md | Document Arithmatex support features and add "Known Behaviors" section explaining HTML entity replacement with CSS alternatives |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaced custom 214-line implementation with a 59-line wrapper around well-tested mdit-py-plugins (dollarmath, texmath, amsmath). Benefits: - 72% code reduction (214 → 59 lines) - Uses battle-tested, maintained upstream plugins - Simpler maintenance burden - Same functionality and test coverage - All 165 tests passing Technical changes: - mdformat_mkdocs/mdit_plugins/_pymd_arithmatex.py: - Now wraps dollarmath_plugin, texmath_plugin, amsmath_plugin - Removed custom regex parsing and token generation - Token types now: math_inline, math_block, amsmath - mdformat_mkdocs/plugin.py: - Added _render_math_inline(), _render_math_block(), _render_amsmath() - Uses token.markup to preserve original delimiters ($, $$, \(, \[, etc.) - Updated RENDERERS mapping This addresses the complexity concern raised in code review.
This commit implements complete solutions for all items in issue #45:
Arithmatex Support (NEW): Implemented full PyMdown Extensions Arithmatex support for LaTeX/math expressions
Entity Replacement (DOCUMENTED): Added documentation explaining that conversion to Unicode is core mdformat behaviorAdded "Known Behaviors" section to READMEDocumented CSS alternatives for spacing (padding, margin, gap, etc.)Updated test fixture comments to explain behaviorAttribute Lists (COMPLETED): Already fixed in previous commits
Changes:
Resolves #45