Skip to content

Deprecate legacy tilde-to-NBSP behavior#1324

Open
lacatoire wants to merge 2 commits intophpDocumentor:mainfrom
lacatoire:fix/tilde-nbsp-deprecation
Open

Deprecate legacy tilde-to-NBSP behavior#1324
lacatoire wants to merge 2 commits intophpDocumentor:mainfrom
lacatoire:fix/tilde-nbsp-deprecation

Conversation

@lacatoire
Copy link
Copy Markdown

This addresses #1314.

The tilde character (~) was being converted to a non-breaking space ( ), a behavior inherited from doctrine/rst-parser that does not match the reStructuredText specification or Sphinx behavior.

Following the approach suggested by @jaapio in #1314, this PR adds a disableLegacyTilde constructor parameter to InlineLexer, passed through InlineParser via DI configuration:

  • When enabled (default), ~ is treated as a regular WORD token
  • When disabled, the legacy NBSP behavior is preserved
  • The :nbsp: text role remains the recommended way to insert non-breaking spaces

Changes

  • InlineLexer: added disableLegacyTilde constructor parameter, conditional in getType()
  • InlineParser: forwards the flag when instantiating the lexer
  • DI config: sets disableLegacyTilde to true by default
  • Unit tests: added tests for both behaviors
  • Functional fixtures: updated nbsp and nbsp-role expected output

The tilde character (~) was converted to a non-breaking space, a
behavior inherited from doctrine/rst-parser that does not match the
reStructuredText specification or Sphinx behavior.

Add a `disableLegacyTilde` flag to InlineLexer, passed through
InlineParser, and enabled by default in the DI configuration. When
enabled, ~ is treated as a regular character. The :nbsp: text role
remains available for explicit non-breaking spaces.
The legacy tilde-to-NBSP behavior is now preserved by default.
Users who want the new behavior can explicitly set disableLegacyTilde to true.
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.

2 participants