Skip to content

Commit 93c913a

Browse files
Fix link title only if it has markup
1 parent ceea755 commit 93c913a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/pandoc_fix_links.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ function Link(el)
77
el.target = target
88

99
local content = {}
10+
local has_markup = false
1011
for _, item in ipairs(el.content) do
1112
if item.text then
1213
table.insert(content, item.text)
1314
end
1415
if item.content then
16+
has_markup = true
1517
for _, subitem in ipairs(item.content) do
1618
table.insert(content, subitem.text)
1719
end
1820
end
1921
end
20-
el.content = table.concat(content, '_')
22+
if has_markup then
23+
el.content = table.concat(content, '_')
24+
end
2125
return el
2226
end

0 commit comments

Comments
 (0)