GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: strip parentheses from file paths generated by llm · Nathanpamart/opencode@6c1a1a7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .opencode
    • bun.lock
    • package.json
  • packages
    • ui/src/components
      • markdown.tsx
    • web/src/components/share
      • content-markdown.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.opencode/bun.lock‎

Copy file name to clipboardExpand all lines: .opencode/bun.lock
+3-3Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎.opencode/package.json‎

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
33
"@octokit/rest": "^22.0.1",
4-
"@opencode-ai/plugin": "0.0.0-dev-202512160508"
4+
"@opencode-ai/plugin": "1.0.162"
55
}
66
}
Collapse file

‎packages/ui/src/components/markdown.tsx‎

Copy file name to clipboardExpand all lines: packages/ui/src/components/markdown.tsx
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ function strip(text: string): string {
77
return match ? match[2] : text
88
}
99

10+
function removeParensAroundFileRefs(text: string): string {
11+
// Remove parentheses around inline code that looks like a file reference
12+
// Matches: (`path/to/file.ext`) or (`path/to/file.ext:1-10`) or (`file.ext:42`)
13+
return text.replace(/\(\s*(`[^`]+\.[a-zA-Z0-9]+(?::\d+(?:-\d+)?)?`)\s*\)/g, "$1")
14+
}
15+
1016
export function Markdown(
1117
props: ComponentProps<"div"> & {
1218
text: string
@@ -17,7 +23,7 @@ export function Markdown(
1723
const [local, others] = splitProps(props, ["text", "class", "classList"])
1824
const marked = useMarked()
1925
const [html] = createResource(
20-
() => strip(local.text),
26+
() => removeParensAroundFileRefs(strip(local.text)),
2127
async (markdown) => {
2228
return marked.parse(markdown)
2329
},
Collapse file

‎packages/web/src/components/share/content-markdown.tsx‎

Copy file name to clipboardExpand all lines: packages/web/src/components/share/content-markdown.tsx
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface Props {
2929
}
3030
export function ContentMarkdown(props: Props) {
3131
const [html] = createResource(
32-
() => strip(props.text),
32+
() => removeParensAroundFileRefs(strip(props.text)),
3333
async (markdown) => {
3434
return markedWithShiki.parse(markdown)
3535
},
@@ -65,3 +65,9 @@ function strip(text: string): string {
6565
const match = text.match(wrappedRe)
6666
return match ? match[2] : text
6767
}
68+
69+
function removeParensAroundFileRefs(text: string): string {
70+
// Remove parentheses around inline code that looks like a file reference
71+
// Matches: (`path/to/file.ext`) or (`path/to/file.ext:1-10`) or (`file.ext:42`)
72+
return text.replace(/\(\s*(`[^`]+\.[a-zA-Z0-9]+(?::\d+(?:-\d+)?)?`)\s*\)/g, "$1")
73+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.