[PR #834] [MERGED] Fix an incorrect offset in GridTableParser. #1243

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/834
Author: @snnz
Created: 12/17/2024
Status: Merged
Merged: 12/18/2024
Merged by: @xoofx

Base: masterHead: fix-gridtables


📝 Commits (1)

  • e92a809 Fixes an incorrect offset in GridTableParser.

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 src/Markdig/Extensions/Tables/GridTableParser.cs (+1 -1)

📄 Description

Instead of the intended index to the table line content, an offset to the global source is used. The resulting offset is beyond the end of the table line, and if there happens to be a bar '|' there, the last character of the line is cut off.

For example:

// 01234567 8 9012345 6 7890123
  "+--+--+\r\n|11|12\r\n>     |"

The start of the second line of the table (9) + the line end (14) is 23, and there is a bar at 23. So this string results in a table containing "11", "1" (not "12").


🔄 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/834 **Author:** [@snnz](https://github.com/snnz) **Created:** 12/17/2024 **Status:** ✅ Merged **Merged:** 12/18/2024 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `fix-gridtables` --- ### 📝 Commits (1) - [`e92a809`](https://github.com/xoofx/markdig/commit/e92a8097d0d0dd1f0c2afb8355905f059f55e3c2) Fixes an incorrect offset in GridTableParser. ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig/Extensions/Tables/GridTableParser.cs` (+1 -1) </details> ### 📄 Description Instead of the intended index to the table line content, an offset to the global source is used. The resulting offset is beyond the end of the table line, and if there happens to be a bar '|' there, the last character of the line is cut off. For example: ``` // 01234567 8 9012345 6 7890123 "+--+--+\r\n|11|12\r\n> |" ``` The start of the second line of the table (9) + the line end (14) is 23, and there is a bar at 23. So this string results in a table containing "11", "1" (not "12"). --- <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:58 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1243