[PR #779] [MERGED] Fix math source span #1220

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/779
Author: @toothache
Created: 3/11/2024
Status: Merged
Merged: 3/14/2024
Merged by: @xoofx

Base: masterHead: fix_math_span


📝 Commits (1)

📊 Changes

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

View changed files

📝 src/Markdig.Tests/TestSourcePosition.cs (+3 -2)
📝 src/Markdig/Extensions/Mathematics/MathInlineParser.cs (+1 -1)

📄 Description

Fix math source span calculation.

The span is wrong if a math is followed with more texts:

Check("0\n012 \abcd\\ 321", @"
paragraph ( 0, 0) 0-15
literal ( 0, 0) 0-0
linebreak ( 0, 1) 1-1
literal ( 1, 0) 2-5
math ( 1, 4) 6-15 (incorrect)
attributes ( 0, 0) 0--1
literal ( 1,10) 12-15
", "mathematics");


🔄 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/779 **Author:** [@toothache](https://github.com/toothache) **Created:** 3/11/2024 **Status:** ✅ Merged **Merged:** 3/14/2024 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `fix_math_span` --- ### 📝 Commits (1) - [`3c7edaa`](https://github.com/xoofx/markdig/commit/3c7edaa82dbf6f3c8fc534d4cb2be3f59ccdd466) Fix math source span. ### 📊 Changes **2 files changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/TestSourcePosition.cs` (+3 -2) 📝 `src/Markdig/Extensions/Mathematics/MathInlineParser.cs` (+1 -1) </details> ### 📄 Description Fix math source span calculation. The span is wrong if a math is followed with more texts: > Check("0\n012 \\$abcd\\$ 321", @" paragraph ( 0, 0) 0-15 literal ( 0, 0) 0-0 linebreak ( 0, 1) 1-1 literal ( 1, 0) 2-5 **math ( 1, 4) 6-15** (incorrect) attributes ( 0, 0) 0--1 literal ( 1,10) 12-15 ", "mathematics"); --- <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:51:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1220