Skip to content

Preserve text spacing in anchors without destinations - #281

Open
oyeong011 wants to merge 1 commit into
matthewwithanm:developfrom
oyeong011:fix/preserve-unlinked-anchor-whitespace
Open

Preserve text spacing in anchors without destinations#281
oyeong011 wants to merge 1 commit into
matthewwithanm:developfrom
oyeong011:fix/preserve-unlinked-anchor-whitespace

Conversation

@oyeong011

Copy link
Copy Markdown

left<a> middle </a>right currently converts to leftmiddleright. An anchor without a destination is emitted as plain text, but convert_a first strips its boundary whitespace as if it were constructing a link label.

Return destinationless anchor content before trimming. This preserves word boundaries for missing/empty href, named anchors, whitespace-only content, and nested inline markup.

Validation: all 84 tests passed on Python 3.11; public API and actual CLI checks passed, including 50 nested spans. Related open PRs #262 (destination escaping) and #280 (emphasis boundary line breaks) were inspected and do not fix destinationless-anchor whitespace. Alternative BeautifulSoup parsers were not tested.

AI disclosure: this patch and its tests were prepared with OpenAI Codex and verified by executing the tests and CLI.

Return unlinked anchor content before trimming link-label whitespace so adjacent words remain separated.

Confidence: high
Scope-risk: narrow
Tested: 84 tests; public API and CLI; nested spans
Not-tested: Alternative BeautifulSoup parsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant