telesoho/vscode-markdown-paste-image

Variable expansion in rules and Lang-rules

KagaJiankui opened this issue · 2 comments

When pasting images online into files, the rules(including Lang-rules) does not expand the pre-defined variables.

For an example, one of my (personal) rules is

{
  "options": "",
  "regex": "^(?:https?://)?(?:.*/)(.*(?<=png|jpg|svg|webp|jpeg|gif))",
  "replace": "${fileBasenameNoExtension}.assets/$1"
}

and the structure of the working directory(after pasting, two images inside the tree are both pasted with the extension) is

Falken-typst/
├── falken_refined.assets/
│   ├── 20230825215737.png
│   └── 20230910065914.png
├── falken_refined.pdf
└── falken_refined.typ

For the pasted images in falken_refined.assets directory, which is correctly parsed, I expect the text after applying the rules are

falken_refined.assets/20230825215737.png

, however the actual text showed up are

${fileBasenameNoExtension}.assets/20230825215737.png

@KagaJiankui
Thank you for your reporting.
Version 1.0.1 has been released to fix it.

Thanks for your extremely quick action, I'll check this out ASAP.