diff --git a/ldoc/markup.lua b/ldoc/markup.lua
index 5451f62..c7af788 100644
--- a/ldoc/markup.lua
+++ b/ldoc/markup.lua
@@ -44,6 +44,9 @@ local function resolve_inline_references (ldoc, txt, item, plain)
res = res:gsub('`([^`]+)`',function(name)
local ref,err = markup.process_reference(name)
if ref then
+ if not plain and name then
+ name = name:gsub('_', '\\_')
+ end
return ('%s '):format(ldoc.href(ref),name)
else
return ''..name..'
'