mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-15 14:05:39 +00:00
[PR #920] Support escaped quotes in generic attribute values #1308
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/920
Author: @jnraine
Created: 1/15/2026
Status: 🔄 Open
Base:
master← Head:support-escaped-quotes-in-attributes📝 Commits (1)
e73a9b0Support escaped quotes in generic attribute values📊 Changes
3 files changed (+207 additions, -26 deletions)
View changed files
📝
src/Markdig.Tests/Specs/GenericAttributesSpecs.generated.cs(+105 -0)📝
src/Markdig.Tests/Specs/GenericAttributesSpecs.md(+53 -0)📝
src/Markdig/Extensions/GenericAttributes/GenericAttributesParser.cs(+49 -26)📄 Description
Hi! I've been using Markdig and it's been great. Wanted to contribute back with this small feature.
This is my first PR here so happy to make any revisions or tweaks as necessary. And also, if this isn't something wanted by the maintainers, feel free to close.
Summary
data-value="hello \"world\"")Motivation
This was discovered when using markdown to generate Word documents from the Markdig AST. Word field codes use quoted strings:
This can work if the outer quotes are changed to single-quotes but escape sequences are useful for our context (and we preprocess the markdown so it works with Markdig today).
Implementation
Follows the same
hasEscapepattern used inLinkHelper.TryParseTitle, usingIsAsciiPunctuation()for escaping.This matches kramdown's behavior for inline attribute lists:
See: https://kramdown.gettalong.org/syntax.html
Test plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.