[PR #57] [MERGED] Adds exceptions to allow certain punctuation characters to behave as inline delimiters #796

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/57
Author: @christophano
Created: 9/14/2016
Status: Merged
Merged: 9/15/2016
Merged by: @xoofx

Base: masterHead: bugfix/punctuation-exceptions


📝 Commits (1)

  • e7df7fa Adds exceptions to allow certain punctuation characters to behave as inline delimiters

📊 Changes

3 files changed (+47 additions, -8 deletions)

View changed files

📝 src/Markdig.Tests/Specs/EmphasisExtraSpecs.md (+11 -0)
📝 src/Markdig.Tests/Specs/Specs.cs (+29 -6)
📝 src/Markdig/Helpers/CharHelper.cs (+7 -2)

📄 Description

I'm not sure how you'll feel about this one.

The CommonMark spec identifies when whitespace and punctuation can be used as left- and right-flanking delimiter runs. This logic is also used for the extra emphasis extension.
There are cases where certain puntuation characters should(?) be allowed.

For example, the minus symbol (or it's more commonly used lookalike, the dash) ought to be allowed as the start of a superscript span:

One quintillionth can be expressed as 10^-18^
<p>One quintillionth can be expressed as 10<sup>-18</sup></p>

One quintillionth can be expressed as 10-18

Similarly the dagger and double-dagger are commonly used as localised note markers (followed by §, || and #) so should be allowed as the sole contents of a superscript span:

Daggers^†^ and double-daggers^‡^ can be used to denote notes.
<p>Daggers<sup></sup> and double-daggers<sup></sup> can be used to denote notes.</p>

Daggers and double-daggers can be used to denote notes.

Note 1: this is implemented as a broad exception for these characters (plus dash, as it is more likely to be used than the actual minus). There is no check for the type of delimiter it is to be used for.

Note 2: i have only added the dagger and double dagger to the exceptions. To extend it to include section, parallels and hash would need a small logic change, as parallels uses 2 characters.


🔄 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/57 **Author:** [@christophano](https://github.com/christophano) **Created:** 9/14/2016 **Status:** ✅ Merged **Merged:** 9/15/2016 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `bugfix/punctuation-exceptions` --- ### 📝 Commits (1) - [`e7df7fa`](https://github.com/xoofx/markdig/commit/e7df7fabeb9fbb1e58842e7cf4be81a76356949f) Adds exceptions to allow certain punctuation characters to behave as inline delimiters ### 📊 Changes **3 files changed** (+47 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/Specs/EmphasisExtraSpecs.md` (+11 -0) 📝 `src/Markdig.Tests/Specs/Specs.cs` (+29 -6) 📝 `src/Markdig/Helpers/CharHelper.cs` (+7 -2) </details> ### 📄 Description I'm not sure how you'll feel about this one. The CommonMark spec identifies when whitespace and punctuation can be used as left- and right-flanking delimiter runs. This logic is also used for the extra emphasis extension. There are cases where certain puntuation characters _should_(?) be allowed. For example, the minus symbol (or it's more commonly used lookalike, the dash) ought to be allowed as the start of a superscript span: > ``` md > One quintillionth can be expressed as 10^-18^ > ``` > > ``` html > <p>One quintillionth can be expressed as 10<sup>-18</sup></p> > ``` > > <p>One quintillionth can be expressed as 10<sup>-18</sup></p> Similarly the dagger and double-dagger are commonly used as localised note markers (followed by §, || and #) so should be allowed as the sole contents of a superscript span: > ``` md > Daggers^†^ and double-daggers^‡^ can be used to denote notes. > ``` > > ``` html > <p>Daggers<sup>†</sup> and double-daggers<sup>‡</sup> can be used to denote notes.</p> > ``` > > <p>Daggers<sup>†</sup> and double-daggers<sup>‡</sup> can be used to denote notes.</p> **Note 1:** this is implemented as a broad exception for these characters (plus dash, as it is more likely to be used than the actual minus). There is no check for the _type_ of delimiter it is to be used for. **Note 2:** i have only added the dagger and double dagger to the exceptions. To extend it to include section, parallels and hash would need a small logic change, as parallels uses 2 characters. --- <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:45:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#796