From 5f00f0d75cfaabb89f2ec22115392443539664bd Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Wed, 14 Nov 2018 15:33:10 +0000 Subject: Use code style For [id] refs in doc comments. --- src/latex.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3