Skip to content

Instantly share code, notes, and snippets.

@tayiorbeii
Created May 12, 2023 16:04
Show Gist options
  • Save tayiorbeii/96c61076fa737407feceb235404635a1 to your computer and use it in GitHub Desktop.
Save tayiorbeii/96c61076fa737407feceb235404635a1 to your computer and use it in GitHub Desktop.
import "@johnlindquist/kit"
// Author: Taylor Bell
// Name: replace-markdown-image-tag
// Description: Reformat a markdown image tag to be a placeholder
let allFiles = await drop()
for (let file of allFiles) {
let content = await readFile(file.path, "utf-8")
let newContent = content.replace(/\!\[.*?\]\((https:\/\/file%2B\.vscode-resource\.vscode-cdn\.net\/.*\/(images-.+?))\)/g, '<img src="./$2" width="720">')
await writeFile(file.path, newContent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment