MCPcopy Create free account
hub / github.com/anomalyco/opencode / codeUrl

Function codeUrl

packages/session-ui/src/components/markdown.tsx:100–109  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

98const urlPattern = /^https?:\/\/[^\s<>()`"']+$/
99
100function codeUrl(text: string) {
101 const href = text.trim().replace(/[),.;!?]+$/, "")
102 if (!urlPattern.test(href)) return
103 try {
104 const url = new URL(href)
105 return url.toString()
106 } catch {
107 return
108 }
109}
110
111function createCopyButton(labels: CopyLabels) {
112 const host = document.createElement("div")

Callers 1

markCodeLinksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected