summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/latex.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/latex.ml b/src/latex.ml
index e0dba234..a86731b6 100644
--- a/src/latex.ml
+++ b/src/latex.ml
@@ -218,9 +218,11 @@ let latex_of_markdown str =
| None -> failwith "Cannot create link to THIS"
end
| Ref (r, name, alt, _) ->
+ (* special case for [id] (format as code) *)
+ let format_fn = if name = alt then inline_code else replace_this in
begin match r#get_ref name with
- | None -> sprintf "\\hyperref[%s]{%s}" (refcode_string name) (replace_this alt)
- | Some (link, _) -> sprintf "\\hyperref[%s]{%s}" (refcode_string link) (replace_this alt)
+ | None -> sprintf "\\hyperref[%s]{%s}" (refcode_string name) (format_fn alt)
+ | Some (link, _) -> sprintf "\\hyperref[%s]{%s}" (refcode_string link) (format_fn alt)
end
| Url (href, text, "") ->
sprintf "\\href{%s}{%s}" href (format text)