Looks tricky, but you may have success by modifying this method here:
Instead of this:
text.gsub!(attachment_regexp) do
index = $1.to_i
real_filename = $2
unreferenced_attachments[index] = nil
attachments.fetch(index, real_filename)
end
You would like something like this:
text.gsub!(attachment_regexp) do
index = $1.to_i
description = $2.strip
unreferenced_attachments[index] = nil
url = attachments.fetch(index, description)
""
end
This is an untested example just to show you where it needs to be modified. I can be wrong.
If I have time Tomorrow I may open a PR with a real solution. ![]()