GeezerVison is showing github.com — fix(shared): inline code with a <placeholder> path segment stays plai… · patroza/t3code@a03617a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/markdownLinks.test.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,6 +63,8 @@ describe("inlineCodeFilePathCandidate", () => { |
63 | 63 | ["/bin/echo hello world.txt", null], |
64 | 64 | ["~/bin/run tests.sh", null], |
65 | 65 | ["/Users/me/notes with spaces.md", "/Users/me/notes with spaces.md"], |
| 66 | + ["~/Videos/clips/<thread-slug>/shot.png", null], |
| 67 | + ["clips/<name>.mp4", null], |
66 | 68 | ])("distinguishes file paths from code and hostnames in %s", (source, candidate) => { |
67 | 69 | expect(inlineCodeFilePathCandidate(source)).toBe(candidate); |
68 | 70 | }); |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/markdownLinks.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -201,7 +201,7 @@ function looksLikeHostname(segment: string, hasPosition: boolean): boolean { |
201 | 201 |
|
202 | 202 | export function inlineCodeFilePathCandidate(codeText: string): string | null { |
203 | 203 | const trimmed = codeText.trim(); |
204 | | - if (trimmed.length === 0 || trimmed.includes("`")) return null; |
| 204 | + if (trimmed.length === 0 || trimmed.includes("`") || /[<>]/.test(trimmed)) return null; |
205 | 205 | if (INLINE_CODE_WHITESPACE_PATTERN.test(trimmed) && !isSpacedAbsoluteFilePath(trimmed)) { |
206 | 206 | return null; |
207 | 207 | } |
|