(match)
| 169 | # - [text](scripts/file.js) - directory-based path |
| 170 | # Matches patterns like: "Read [`docx-js.md`](docx-js.md)" or "Load [Guide](./reference/guide.md)" |
| 171 | def replace_markdown_link(match): |
| 172 | prefix = match.group(1) if match.group(1) else "" # e.g., "Read ", "Load ", or empty |
| 173 | link_text = match.group(2) # e.g., "`docx-js.md`" or "Guide" |
| 174 | filepath = match.group(3) # e.g., "docx-js.md", "./reference/file.md", "scripts/file.js" |
| 175 | |
| 176 | # Remove leading ./ if present |
| 177 | clean_path = filepath[2:] if filepath.startswith("./") else filepath |
| 178 | |
| 179 | abs_path = skill_dir / clean_path |
| 180 | if abs_path.exists(): |
| 181 | # Preserve the link text style (with or without backticks) |
| 182 | return f"{prefix}[{link_text}](`{abs_path}`) (use read_file to access)" |
| 183 | return match.group(0) |
| 184 | |
| 185 | # Match markdown link patterns with optional prefix words |
| 186 | # Captures: (optional prefix word) [link text] (complete file path including ./) |
nothing calls this directly
no outgoing calls
no test coverage detected