You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7ddc786
Browse filesBrowse the repository at this point in the historyBrowse files
fix(web): keep windows drive paths clickable in chat markdown
A markdown destination like `D:/tmp/example.md` rendered as styled but dead
text, and it failed differently on each of the two pipelines chat uses.
Assistant messages leave `parseRawHtml` at its default of true, so they run
`rehype-sanitize`, which reads `D:` as an unknown protocol and removes the
href before `urlTransform` is reached. User messages pass false, skip the
sanitizer, and React Markdown's `defaultUrlTransform` blanks the same
destination for the same reason. Either way the anchor arrives without an
href and cannot match an entry in `markdownFileLinkMetaByHref`, even though
that map has already resolved the path from the raw message text.
Both pipelines run remark, so the destination is normalized there:
`toFilesystemLinkUrl` maps a drive path to the `file:` URL the sanitizer
already allows, and `rewriteMarkdownFileUriHref` maps it back on the way out.
`resolveMarkdownFileLinkTarget` already handled these paths, so this is only
about getting them that far.
Link keys go through the same function, so `M:\dir\file.md` in the source and
the `M:/dir/file.md` the renderer receives resolve to one key rather than
missing each other on the separator.
The anchor resolves a drive destination itself when the metadata map misses.
That map is built by scanning the message text for inline links with a plain
destination, so balanced parentheses, nested brackets and bracketed
destinations with spaces are absent from it; without the fallback those would
render as ordinary anchors pointing at a drive path with no file action.
The sanitize schema is exported so the tests can render both pipelines with
the real configuration; that needs an explicit type annotation because its
inferred type is not nameable outside the module.
This covers markdown destinations only. A bare `M:\dir\file.md` written as
plain text is still not linked, because GFM does not autolink filesystem
paths and adding that is a separate change.
0 commit comments