From 21d9c39d229302e0976fb327d57b7a803ce5175b Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Fri, 23 Aug 2024 09:39:30 -0500 Subject: [PATCH] don't identify `[..., @foo-bar]` as cross reference, which should be citation instead --- DESCRIPTION | 2 +- R/mark.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 767d1e1..e8560d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: litedown Type: Package Title: A Lightweight Version of R Markdown -Version: 0.1.1 +Version: 0.1.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person() diff --git a/R/mark.R b/R/mark.R index d51717c..cf4cd60 100644 --- a/R/mark.R +++ b/R/mark.R @@ -197,7 +197,7 @@ mark = function(input, output = NULL, text = NULL, options = NULL, meta = list() # turn @ref into [@ref](#ref) and resolve cross-references later in JS; for # latex output, turn @ref to \ref{} r_ref = '([a-z]+)-([-_[:alnum:]]+)' # must start with letters followed by - - r5 = paste0('(^|(?<=\\s|\\())@', r_ref) + r5 = paste0('(^|(?<=\\s|\\())@', r_ref, '(?!\\])') if (test_feature('cross_refs', r5)) { text[p] = match_replace(text[p], r5, function(x) { sprintf('[%s](%s)', x, sub('^@', '#', x))