Skip to content

Commit b7ab801

Browse files
committed
close #98: add a message to remind users of calling pkg_code() in the package source dir
1 parent 985fd6b commit b7ab801

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: litedown
22
Type: Package
33
Title: A Lightweight Version of R Markdown
4-
Version: 0.7.6
4+
Version: 0.7.7
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")),
77
person("Tim", "Taylor", role = "ctb", comment = c(ORCID = "0000-0002-8587-7113")),
@@ -21,8 +21,8 @@ Description: Render R Markdown to Markdown (without using 'knitr'), and Markdown
2121
Depends: R (>= 3.2.0)
2222
Imports:
2323
utils,
24-
commonmark (>= 1.9.5),
25-
xfun (>= 0.52)
24+
commonmark (>= 2.0.0),
25+
xfun (>= 0.54)
2626
Suggests:
2727
rbibutils,
2828
rstudioapi,

R/package.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ pkg_code = function(
255255
path = attr(detect_pkg(), 'path'), pattern = '[.](R|c|h|f|cpp)$', toc = TRUE,
256256
number_sections = TRUE, link = TRUE
257257
) {
258-
if (!isTRUE(dir.exists(path))) return()
258+
if (!isTRUE(dir.exists(path))) {
259+
if (missing(path)) message('Please run this function in the package source directory.')
260+
return()
261+
}
259262
a = header_class(toc, number_sections)
260263
if (isTRUE(link) && length(u <- github_link(path))) link = paste0(u, 'blob/HEAD/%s')
261264
ds = c('R', 'src')

0 commit comments

Comments
 (0)