I’d like to remove all markdown links but keep the link text and square bracket using Lua filter. For example, the original content is like:
[@a-local-file, page 15](x-devonthink-item://742BD8FE-B962-422F-98C1-B1K4DQA5A117?page=15)
And I’d like to convert it to:
[@a-local-file, page 15]
I’ve tried to write a Lua filter for this conversion:
function Link(el)
if el.target:find("^x%-devonthink%-item://") then
return el.content
end
end
However, with this Lua filter, it returned only the link text:
@a-local-file, page 15
There is a related question but the answer is not very straightforward to my question. Because my purpose is to use
[@a-local-file, page 15]
as NormalCitation
. But if a pair of
square brackets is added, it will be changed as AuthorInText
,
which is undesirable.
How to modify the code to keep both link text and square brackets for Pandoc’s normal citations? Thanks in advance!