fix(jetbrains): linkify urls inside inline code - #13551
Merged
Merged
Conversation
CommonMark's autolink extension skips code spans, so a URL written in backticks rendered as inert text in chat messages while bare URLs became links. Extend the post-render pass in MdCommon that already linkifies file references so it also wraps http(s) URLs, giving them link color, underline, hover, and click handling inside inline code.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Previous Review Summary (commit 1d6744e)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 1d6744e)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 144.5K · Output: 12.9K · Cached: 311.4K Review guidance: REVIEW.md from base branch |
marius-kilocode
approved these changes
Aug 28, 2026
Replace the custom URL boundary and bracket trimming logic with the same org.nibor.autolink scanner used by CommonMark's autolink extension. Run it against raw inline-code AST literals so HtmlWriter owns escaping, and declare the dependency explicitly so Gradle bundles it with the plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
No issue filed; reported directly while reviewing a JetBrains release report where every URL was unclickable.
Context
In the JetBrains chat transcript,
http/httpsURLs written inside backticks render as inert text — no hover, no cursor change, no click. Agents routinely emit URLs as inline code (release reports, PR links, run URLs), so a large share of the links a user sees in the JetBrains plugin are dead.The link plumbing itself was fine. The gap is that CommonMark's
AutolinkExtensiononly visits text nodes, never code spans, so`https://…`never becomes an anchor. Bare URLs already worked end to end.Implementation
The HTML renderer now overrides CommonMark's core
Codenode renderer. It runsorg.nibor.autolink.LinkExtractorover each raw inline-code literal and emits anchors forhttp/httpsspans beforeHtmlWriterescapes their text and attributes. This is the same URL scanner used by CommonMark's existing autolink extension, so trailing punctuation, balanced brackets, quote boundaries, control characters, and Unicode whitespace follow the library's tested behavior instead of custom URL parsing.Only
httpandhttpsmatches become links.LinkType.URLcan detect anyscheme://…, while the session link router sends non-file schemes to the browser; filtering here preventsfile,ftp, or other schemes from being routed incorrectly.org.nibor.autolink:autolink:0.12.0is declared explicitly as animplementationdependency in the frontend module and pinned in the version catalog. We do not rely on an IntelliJ-bundled classpath or on CommonMark's transitive dependency edge.buildPluginpackages it askilo.jetbrains/lib/autolink-0.12.0.jarin the distributable ZIP.MdCommononly retains the CSS rule for the generatedkilo-url-refanchors: standard IDE link color and underline while preserving the inline-code monospace font. Existing click handling remains unchanged (MdView.LinkEvent→openSessionLink→BrowserUtil.browse), and fenced code remains on the separate editor/code-block rendering path.Screenshots / Video
N/A — the visual delta is that an inline-code URL picks up the standard IDE link color and underline; there is no new UI surface. Behavior is asserted in tests against the rendered
HTMLDocument.How to Test
Manual/local verification
./gradlew testfrompackages/kilo-jetbrains/— passed (executed by the agent)./gradlew typecheckfrompackages/kilo-jetbrains/— passed (executed by the agent)./gradlew buildPluginfrompackages/kilo-jetbrains/— passed (executed by the agent)build/distributions/kilo.jetbrains-7.1.0.zip; it containskilo.jetbrains/lib/autolink-0.12.0.jar(executed by the agent)MdViewTest(executed by the agent): a code-span URL produces<a class="kilo-url-ref">plus the matching CSS rule; query separators survive in the href; trailing punctuation and unbalanced brackets stay outside the link; balanced brackets stay inside; URL scanning stops at characters that cannot appear in a URL; autolinked and markdown-link URLs are not wrapped a second time; fenced-code URLs are not linkified; a URL followed by a file reference produces both link kinds.MdViewHybridTest(executed by the agent): the renderedHTMLDocumentcontains a liveAelement with the expectedhref, and activating it dispatches anMdView.LinkEvent.Reviewer test steps
./gradlew runIdefrompackages/kilo-jetbrains/Release PR: `https://github.com/Kilo-Org/kilocode/pull/13524`[text](url)link still behave as beforeBlocked checks and substitute verification
Checklist
Get in Touch
N/A