Download scripts/linkify-logs.js from AbdulElahGwaith/content: direct link, hf CLI and curl.
- Browser
- Download file 529 Bytes
-
https://huggingface.co/AbdulElahGwaith/content/resolve/main/scripts/linkify-logs.js
- Command line
-
hf download hf://AbdulElahGwaith/content/scripts/linkify-logs.js
-
curl -L -o linkify-logs.js https://huggingface.co/AbdulElahGwaith/content/resolve/main/scripts/linkify-logs.js
529 Bytes
| /* | |
| * The script converts file paths to GitHub source links in the provided text. | |
| * Usage: node scripts/linkify-logs.js ${logs} | |
| */ | |
| const logs = process.argv[2]; | |
| console.log( | |
| logs.replaceAll( | |
| /(files\/.*?\/index.md):?(\d+)?:?(\d+)?/g, | |
| (_, path, lineNo, columnNo) => { | |
| if (lineNo) { | |
| return `[${path}:${lineNo}:${columnNo}](https://github.com/mdn/content/blob/main/${path}?plain=1#L${lineNo})`; | |
| } | |
| return `[${path}](https://github.com/mdn/content/blob/main/${path}?plain=1)`; | |
| }, | |
| ), | |
| ); | |