mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 21:03:56 +00:00
fix: markdown link rendering for links with identical text and href
This commit is contained in:
parent
38524ea900
commit
59af0fd53a
2 changed files with 6 additions and 1 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Markdown Link Rendering**: Fixed links with identical text and href (e.g., `https://github.com/badlogic/pi-mono/pull/48/files`) being rendered twice. Now correctly compares raw text instead of styled text (which contains ANSI codes) when determining if link text matches href.
|
||||||
|
|
||||||
## [0.8.5] - 2025-11-21
|
## [0.8.5] - 2025-11-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,8 @@ export class Markdown implements Component {
|
||||||
case "link": {
|
case "link": {
|
||||||
const linkText = this.renderInlineTokens(token.tokens || []);
|
const linkText = this.renderInlineTokens(token.tokens || []);
|
||||||
// If link text matches href, only show the link once
|
// If link text matches href, only show the link once
|
||||||
if (linkText === token.href) {
|
// Compare raw text (token.text) not styled text (linkText) since linkText has ANSI codes
|
||||||
|
if (token.text === token.href) {
|
||||||
result += this.theme.link(this.theme.underline(linkText)) + this.applyDefaultStyle("");
|
result += this.theme.link(this.theme.underline(linkText)) + this.applyDefaultStyle("");
|
||||||
} else {
|
} else {
|
||||||
result +=
|
result +=
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue