I’m using pandoc to generate this website from markdown files to html, and the
problem that all my images are converted into
, but my goal is to just generate a normal img tag with altattribute, and to solve this issue I need to convert all my image formats from

]((.*))/
-
<.'>This indicates the code range to apply the command only for the current
visually selected and for this case I select the entire line withshift+v. -
s/this the shorthand for:substitute
s//
-
)- escape all special characters
![]by adding backslashbefore each
of them - define a group to capture all text inside the square brackets
[]by
using(.*) - the define another group to capture the path inside
()by using the
(.*)
- escape all special characters
-
now we change the entire line with our format and-
2refers to the second capture group which is the pathpath.jpg -
1refers to the first capture group which is the title"title"
-
Search for all image occurrences
Now after we know our command to change the image format, we need to search for
all image occurrences in markdown files in the src directory.
So, we can use vim grep command like that
NOTE: I’m using neovim v0.11 which is use
ripgrepby default. So,
maybe some arguments here will not work with normal grep
:silent grep "![" src --glob "*.md"
Now we have all our results inside the quickfix list, we can use
:c[next|prev] command to cycle between the list and apply our command for each
one, but that will be executed and non-efficient.
Apply the command for quickfix list
Fortunately, that vim has a built-in feature to apply any command to all files
inside the qucikfix list by using :cdo command, so here is the command will
be:
:silent cdo! s/)//g
We add /g as well to apply the command in all files. Also if you need
manually confirm for each substitute you add /gc.
Finally save the files
So after everything is good we need to save every change by using
:wa!
