1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/script/bookmarklets/open-in-vscode.js
2022-04-13 15:53:59 -04: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')