[PR #452] [MERGED] Bug/parsing math #1035

Open
opened 2026-01-29 14:48:55 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/452
Author: @davidackroyd99
Created: 7/21/2020
Status: Merged
Merged: 7/22/2020
Merged by: @xoofx

Base: masterHead: bug/parsing-math


📝 Commits (2)

  • 477a290 typo: fixed comment in ApiController
  • 8758ba4 fix: parsing math blocks with no leading or trailing whitespace

📊 Changes

2 files changed (+3 additions, -5 deletions)

View changed files

📝 src/Markdig.WebApp/ApiController.cs (+1 -1)
📝 src/Markdig/Extensions/Mathematics/MathInlineParser.cs (+2 -4)

📄 Description

This fixes #451

Before my change the parser would look to see if the next character after the or$ was a digit. It would then fail to match if it was a digit, which means that $x$ would be a valid math block but $2x$ would not be.

I simply removed this check as $2x$ should be valid, but it still allows $ 2x $ in order to be backwards compatible.

I also changed the WebApi project comment that specified that the second parameter should be extensions, where as actually it should just be extension as per the controller method definition. This confused me when I was trying to replicate the bug.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/xoofx/markdig/pull/452 **Author:** [@davidackroyd99](https://github.com/davidackroyd99) **Created:** 7/21/2020 **Status:** ✅ Merged **Merged:** 7/22/2020 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `bug/parsing-math` --- ### 📝 Commits (2) - [`477a290`](https://github.com/xoofx/markdig/commit/477a29053898ab7ac83bb1063ad2bb283986f714) typo: fixed comment in ApiController - [`8758ba4`](https://github.com/xoofx/markdig/commit/8758ba460f9b433fd18003b982c0e9693ceaeb88) fix: parsing math blocks with no leading or trailing whitespace ### 📊 Changes **2 files changed** (+3 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.WebApp/ApiController.cs` (+1 -1) 📝 `src/Markdig/Extensions/Mathematics/MathInlineParser.cs` (+2 -4) </details> ### 📄 Description This fixes [#451](https://github.com/lunet-io/markdig/issues/451) Before my change the parser would look to see if the next character after the $ or $$ was a digit. It would then fail to match if it _was_ a digit, which means that `$x$` would be a valid math block but `$2x$` would not be. I simply removed this check as `$2x$` should be valid, but it still allows `$ 2x $` in order to be backwards compatible. I also changed the WebApi project comment that specified that the second parameter should be **extensions**, where as actually it should just be **extension** as per the controller method definition. This confused me when I was trying to replicate the bug. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 14:48:55 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1035