Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the markdown package from Imports to Suggests #1864

Open
yihui opened this issue Jun 21, 2020 · 11 comments
Open

Move the markdown package from Imports to Suggests #1864

yihui opened this issue Jun 21, 2020 · 11 comments

Comments

@yihui
Copy link
Owner

@yihui yihui commented Jun 21, 2020

Base64 encoding no longer depends on markdown: 76fef5b

The next step is to notify package authors who use R Markdown vignettes based on the vignette engine knitr::knitr (or knitr::docco_linear, knitr::docco_classic, etc.) that they should declare the (soft) dependency on markdown, e.g., in the package DESCRIPTION:

Suggests: markdown
VignetteBuilder: knitr

Previously they didn't need to do this because markdown is a hard dependency of knitr (in Imports), so the availability of markdown is guaranteed by knitr, but I want to make markdown a soft dependency of knitr in the future.

Historically, I made markdown the hard dependency of knitr at the request of a BioConductor maintainer. I have regretted this decision for long.

I think most packages use the vignette engine knitr::rmarkdown to write vignettes now, but there may still be a few vignettes using the knitr::knitr engine, which depends on markdown. If I move markdown to Suggests in knitr, users have to make sure markdown is available to R CMD check. To achieve that, they have to add markdown to Suggests to their DESCRIPTION files.

If you are a package author affected by this issue, but not clear about what you need to do, please reply below and I'll be glad to help. Thanks!

yihui added a commit that referenced this issue Jun 21, 2020
… package containing vignettes based on the knitr::knitr engine
@tdhock
Copy link

@tdhock tdhock commented Jun 24, 2020

hi I got this from win-builder:


* checking re-building of vignette outputs ... [1s] WARNING
Error(s) in re-building vignettes:
--- re-building 'examples.Rmd' using knitr
Error: processing vignette 'examples.Rmd' failed with diagnostics:
The 'markdown' package should be declared as a dependency of the 'directlabels' package (e.g., in the  'Suggests' field of DESCRIPTION), because it contains vignette(s) built with the 'markdown' package. Please see https://github.com/yihui/knitr/issues/1864 for more information.
--- failed re-building 'examples.Rmd'

SUMMARY: processing the following file failed:
  'examples.Rmd'

Error: Vignette re-building failed.
Execution halted

my vignette uses

%\VignetteEngine{knitr::knitr}

which I think does not require markdown (even in suggests), if I understand your discussion above correctly. so it seems strange that I would need to add markdown in suggests. do I really have to?

@yihui
Copy link
Owner Author

@yihui yihui commented Jun 24, 2020

Yes, you have to.

@tdhock
Copy link

@tdhock tdhock commented Jun 24, 2020

ok

@mschubert
Copy link

@mschubert mschubert commented Jun 27, 2020

I think I'm getting a false positive warning on the CRAN Winbuilder. I've got all my vignettes set to

%\VignetteEngine{knitr::rmarkdown}

If I have not set in DESCRIPTION that

Suggests:
    rmarkdown

I'm getting no warnings locally (R=4.0.2, rmarkdown=2.2, knitr=1.28). On the CRAN Winbuilder, I'm getting:

Error: processing vignette 'quickstart.Rmd' failed with diagnostics:
The 'markdown' package should be declared as a dependency of the 'clustermq' package (e.g., in the 'Suggests' field of DESCRIPTION), because it contains vignette(s) built with the 'markdown' package. Please see #1864 for more information.

The missing package, however, is Suggests: rmarkdown and not markdown.

@yihui
Copy link
Owner Author

@yihui yihui commented Jun 27, 2020

@mschubert I need a reproducible example. Could you provide a link to your package (presumably on Github?)? Thanks!

@mschubert
Copy link

@mschubert mschubert commented Jun 27, 2020

Package was clustermq:3d223af and you can find the Winbuilder output here. I won't have time to track this down further unfortunately (since adding Suggests: rmarkdown solves the issue & a warning for the right package is there), sorry.

@yihui
Copy link
Owner Author

@yihui yihui commented Jun 27, 2020

@mschubert In your case, you are using the vignette engine knitr::rmarkdown, so you have to add rmarkdown to Suggests (which you did mschubert/clustermq@02e06f8): https://yihui.org/knitr/demo/vignette/ Because you didn't do that, you saw the message about markdown, and that was because knitr fell back to using markdown to build your vignettes. Neither rmarkdown nor markdown was specified in your Suggests, and that's why you saw the error.

@mschubert
Copy link

@mschubert mschubert commented Jun 27, 2020

Yes, that's what I tried to say - sorry if that was not clear. My comment was that the error message of "missing markdown package in Suggests" is confusing when the vignette states that it uses rmarkdown (and the markdown package should never be required).

Perhaps a better error message would be to add whatever markdown builder you use to Suggests? Or, maybe do nothing, but I thought it was useful to document that this message is also displayed when rmarkdown is missing (I guess people will google the issue and find this).

@yihui
Copy link
Owner Author

@yihui yihui commented Jun 27, 2020

@mschubert Yes, I definitely agree the messages were confusing in this case. I'll think more about it and try to make it clearer. Thanks a lot for your feedback!

kaz-yos added a commit to kaz-yos/tableone that referenced this issue Jul 13, 2020
Experienced the following in winbuild

* checking re-building of vignette outputs ... [1s] WARNING
Error(s) in re-building vignettes:
--- re-building 'introduction.Rmd' using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  The vignette engine knitr::rmarkdown is not available, because the rmarkdown package is not installed. Please install it.
  Error: processing vignette 'introduction.Rmd' failed with diagnostics:
  The 'markdown' package should be declared as a dependency of the 'tableone' package (e.g., in the  'Suggests' field of DESCRIPTION), because it contains vignette(s) built with the 'markdown' package. Please see yihui/knitr#1864 for more information.
  --- failed re-building 'introduction.Rmd'

--- re-building 'smd.Rmd' using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  The vignette engine knitr::rmarkdown is not available, because the rmarkdown package is not installed. Please install it.
  Error: processing vignette 'smd.Rmd' failed with diagnostics:
  The 'markdown' package should be declared as a dependency of the 'tableone' package (e.g., in the  'Suggests' field of DESCRIPTION), because it contains vignette(s) built with the 'markdown' package. Please see yihui/knitr#1864 for more information.
  --- failed re-building 'smd.Rmd'

SUMMARY: processing the following files failed:
  'introduction.Rmd' 'smd.Rmd'

Error: Vignette re-building failed.
@jooolia jooolia mentioned this issue Jul 14, 2020
16 of 21 tasks complete
@nsheff
Copy link

@nsheff nsheff commented Jul 14, 2020

I agree with @mschubert. I had the same situation. I was about to add 'markdown' to suggests because of the message, when I really should have added 'rmarkdown' to suggests, because I use knitr::rmarkdown (if I understood correctly).

codycarroll added a commit to functionaldata/tPACE that referenced this issue Jul 28, 2020
yihui added a commit that referenced this issue Sep 22, 2020
…the vignette engine knitr::rmarkdown is used (#1864)
mikejohnson51 added a commit to mikejohnson51/dataRetrieval that referenced this issue Sep 22, 2020
* creating vignettes ... ERROR

--- re-building 'dataRetrieval.Rmd' using rmarkdown

Warning in engine$weave(file, quiet = quiet, encoding = enc) :

  The vignette engine knitr::rmarkdown is not available because the rmarkdown package is not available. Did you forget to add it to Suggests in DESCRIPTION? Please see yihui/knitr#1864 for more information.

Loading required namespace: sf

--- finished re-building 'dataRetrieval.Rmd'
@yihui
Copy link
Owner Author

@yihui yihui commented Sep 30, 2020

With knitr 1.30 (the current latest version on CRAN), the message should tell you to add rmarkdown instead of markdown to Suggests when the vignette engine knitr::rmarkdown is used.

mpadge added a commit to hypertidy/geodist that referenced this issue Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.