[PR #836] [MERGED] Fix an error in the AbbreviationParser. #1242

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/836
Author: @snnz
Created: 12/18/2024
Status: Merged
Merged: 12/19/2024
Merged by: @xoofx

Base: masterHead: fix-abbreviation


📝 Commits (3)

  • 5e4a917 Fixes an error in the AbbreviationParser.
  • 2cff6c5 It's necessary to keep a copy of the original literal.Span.End, because otherwise it is just lost in some cases.
  • bc41b0c Existing test has been extended.

📊 Changes

2 files changed (+7 additions, -2 deletions)

View changed files

📝 src/Markdig.Tests/TestSourcePosition.cs (+5 -1)
📝 src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs (+2 -1)

📄 Description

The modified end of the previous literal is assigned to the literal next to abbrevion. The test of the abbreviations in TestSourcePosition.cs passes only because there is an abbreviation at the end of the string, and thus no literal remains after it. But add some literals after the abbreviation, say, a period '.', and instead of expected literal with the span 103-103 there will be one with the end less then the start (103-98).


🔄 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/836 **Author:** [@snnz](https://github.com/snnz) **Created:** 12/18/2024 **Status:** ✅ Merged **Merged:** 12/19/2024 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `fix-abbreviation` --- ### 📝 Commits (3) - [`5e4a917`](https://github.com/xoofx/markdig/commit/5e4a917dbd25c6c40e2d184cfaca908c2908aca5) Fixes an error in the AbbreviationParser. - [`2cff6c5`](https://github.com/xoofx/markdig/commit/2cff6c51949324ace802cf0a5880160fa2627470) It's necessary to keep a copy of the original literal.Span.End, because otherwise it is just lost in some cases. - [`bc41b0c`](https://github.com/xoofx/markdig/commit/bc41b0c2a33278489319ff9fa0c0c4c9ca1f7ba1) Existing test has been extended. ### 📊 Changes **2 files changed** (+7 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/TestSourcePosition.cs` (+5 -1) 📝 `src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs` (+2 -1) </details> ### 📄 Description The modified end of the previous literal is assigned to the literal next to abbrevion. The test of the abbreviations in TestSourcePosition.cs passes only because there is an abbreviation at the end of the string, and thus no literal remains after it. But add some literals after the abbreviation, say, a period '.', and instead of expected literal with the span 103-103 there will be one with the end less then the start (103-98). --- <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:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1242