1
0
mirror of synced 2026-01-03 15:05:54 -05:00
Files
docs/src/bookmarklets/open-in-vscode.js
Kevin Heis 748d1e3e3d Move files out of script/ (#45454)
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2023-11-02 18:17:39 +00:00

9 lines
372 B
JavaScript

/* The path to your local copy of repo */
const checkoutPath = 'REPLACE_ME'
const filepath = window.location.pathname.replace(/\/en\/([^@]+?@[^@]+?\/)?/, '/content/')
const isIndexFile = filepath.split('/').length < 5
const filename = isIndexFile ? '/index.md' : '.md'
const fullpath = 'vscode://file' + checkoutPath + filepath + filename
window.open(fullpath, '_blank')