Skip to content

Fix hover markdown escaping so links are usable#1159

Merged
datho7561 merged 2 commits intoredhat-developer:mainfrom
shin19991207:chang-patch-1151
Dec 18, 2025
Merged

Fix hover markdown escaping so links are usable#1159
datho7561 merged 2 commits intoredhat-developer:mainfrom
shin19991207:chang-patch-1151

Conversation

@shin19991207
Copy link
Member

What does this PR do?

Hover content is rendered as Markdown, so plain-text schema descriptions must be escaped for Markdown. The current escaping escapes punctuation like . and (), which can, for example, change a URL at the end of a sentence into https://hub\.docker\.com/\.. When the text is being auto-linkified by the hover renderer, it then include the backslash in the auto-detected link, making it end with \ and become unusable (for example, https://hub.docker.com/\).

This is fixed by updating YamlHover.toMarkdown() to stop escaping punctuation commonly used with URLs i.e. . ( ).

Note: Best practice is for schemas to wrap URLs in <...> (for example, <https://example.com>), so the renderer treats them as explicit autolinks and they reliably stay usable.

What issues does this PR fix or reference?

Is it tested? How?

Automated test:

  • Added hover tests to ensure () parentheses and . dots remain literal even without escaping in descriptions.
  • Added hover tests to ensure URLs next to () or . stay usable.

Manual test:

  • Create a file .github/workflows/daily.yaml
  • Add content:
    name: Daily
    
    on:
      schedule:
        # Runs daily at 10:15 CET (09:15 UTC)
        - cron: '15 9 * * *'
      workflow_dispatch:  # Allow manual triggering
    
    jobs:
      update-data:
        runs-on: ubuntu-latest
        
        steps:
        - name: Checkout repository
          uses: actions/checkout@v4
  • Hover over to the text actions/checkout@v4. Links in there should be usable.

Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
@coveralls
Copy link

Coverage Status

coverage: 84.085%. remained the same
when pulling 8ef6065 on shin19991207:chang-patch-1151
into 23a2e61 on redhat-developer:main.

@datho7561 datho7561 linked an issue Dec 18, 2025 that may be closed by this pull request
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and addresses the bug. It's pretty safe to not escape these special characters, I think they're used exclusively for links and ordered lists. Thanks, Morgan!

@datho7561 datho7561 merged commit 53d0a34 into redhat-developer:main Dec 18, 2025
4 checks passed
@shin19991207 shin19991207 deleted the chang-patch-1151 branch February 18, 2026 18:45
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.

Some links are escaped making them unusable

3 participants