Skip to content

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jul 21, 2025

Summary

  • Fixes issue where backslashes in <tt> tags caused unwanted cross-reference links
  • Adds validation to ensure escaped characters don't trigger false positive cross-references
  • Preserves normal cross-reference functionality for valid method/class references

Problem

When text in <tt> tags contains backslashes (e.g., <tt>.bar.hello(\)</tt>), RDoc was incorrectly creating cross-reference links. This happened because the backslash matched the escaped character pattern in CROSSREF_REGEXP, causing the entire string to be processed as a potential cross-reference.

Solution

Added checks in both handle_regexp_CROSSREF and convert_flow to detect when a match is solely due to escaped character patterns that don't represent valid method/class references. These strings are now rendered as code without creating links.

Test plan

  • Added new test case test_convert_CROSSREF_backslash_escapes_in_monofont to verify the fix
  • Confirmed existing tests pass
  • Tested with the reproduction case from the issue

Fixes #1390

🤖 Generated with Claude Code

When text in <tt> tags contains backslashes (e.g., <tt>.bar.hello(\)</tt>),
RDoc was incorrectly creating cross-reference links because the backslash
matched the escaped character pattern in CROSSREF_REGEXP.

This fix adds a check to prevent cross-referencing when the match is solely
due to escaped characters that don't represent valid method/class references.

Fixes #1390

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@matzbot
Copy link
Collaborator

matzbot commented Jul 21, 2025

🚀 Preview deployment available at: https://c9148c78.rdoc-6cd.pages.dev (commit: 58b0238)

@st0012 st0012 closed this Jul 21, 2025
@st0012 st0012 deleted the fix-backslash-monofont-linking branch July 21, 2025 16:44
@st0012
Copy link
Member Author

st0012 commented Jul 21, 2025

Sorry for the noise. I ran the wrong claude command.

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.

Backslash in RDoc monofont causes linking

2 participants