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

Export the Target Markdown engine so {knitr} can register it directly #503

Closed
2 tasks done
wlandau opened this issue Jun 7, 2021 · 3 comments
Closed
2 tasks done

Comments

@wlandau
Copy link
Member

wlandau commented Jun 7, 2021

Prework

  • Read and agree to the code of conduct and contributing guidelines.
  • If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
  • [N/A] For any problems you identify, post a minimal reproducible example like this one so the maintainer can troubleshoot. A reproducible example is:
    • [N/A] Runnable: post enough R code and data so any onlooker can create the error on their own computer.
    • [N/A] Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
    • [N/A] Readable: format your code according to the tidyverse style guide.

Description

Thanks @yihui for being willing to register the engine from knitr!

wlandau-lilly added a commit that referenced this issue Jun 7, 2021
@yihui
Copy link

yihui commented Jun 7, 2021

Please feel free to open a PR to knitr after the next version of targets is on CRAN: https://github.com/yihui/knitr/blob/440d1a694e791f5516500472fe99cad84237eaeb/R/engine.R#L777-L785

Before it is "officially" registered in knitr, you can make the transition smoother by testing if is.null(knitr::knit_engines$get('targets')) on your side, and register the engine only when it is NULL. Then after the future version of knitr that officially supports this engine is on CRAN, you can remove the registration on your side.

BTW, you have zero open issues in this repo? Seriously? That's amazing. I feel jealousy.

@wlandau
Copy link
Member Author

wlandau commented Jun 8, 2021

Please feel free to open a PR to knitr after the next version of targets is on CRAN: https://github.com/yihui/knitr/blob/440d1a694e791f5516500472fe99cad84237eaeb/R/engine.R#L777-L785

That's very generous of you, Yihui! I plan to update targets on CRAN on July 21, and I will definitely submit a PR to knitr soon after. Looks straightforward to implement on my end.

Before it is "officially" registered in knitr, you can make the transition smoother by testing if is.null(knitr::knit_engines$get('targets')) on your side, and register the engine only when it is NULL. Then after the future version of knitr that officially supports this engine is on CRAN, you can remove the registration on your side.

Good point, implemented in d103581. Companies in my industry are usually slow to catch up with CRAN, so I may wait a few more months before removing the engine registration from .onLoad() in targets.

BTW, you have zero open issues in this repo? Seriously? That's amazing. I feel jealousy.

Thanks! Definitely feels good to be reasonably caught up. Really enjoying GitHub Discussions for the more fluid threads.

@yihui
Copy link

yihui commented Jun 8, 2021

Sounds great!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 18, 2021
(https://github.com/yihui/knitr/releases)
@yihui yihui released this Sep 9, 2021

NEW FEATURES

  * Added a package option latex.tilde so that users can customize the tilde
    symbol, e.g., you can set knitr::opts_knit$set(latex.tilde = "\\hlopt{\\
    scriptsize{\\ensuremath{\\sim}}}"). This is because the default tilde is
    too high in the PDF output, and it's often more desirable to use a middle
    tilde instead (thanks, @brry #1992, @jaredlander #492).

  * For the tikz engine, the class options of the standalone document classs
    can be specified via the chunk option engine.opts$classoption (thanks,
    @XiangyunHuang, #1985). The default value is tikz, i.e., \documentclass
    [tikz]{standalone} is used by default.

  * Added the ability to pass additional arguments to dvisvgm when using the
    tikz engine with fig.ext = "svg" by using dvisvgm.opts in engine.opts
    (thanks, @andrewheiss, #2039). Recent versions of dvisvgm now allow you to
    embed fonts into SVG files as base64-encoded WOFF files, so tikz chunks can
    embed fonts using like so: ```{tikz, fig.ext="svg", engine.opts=list
    (dvisvgm.opts = "--font-format=woff")}.

  * Added a new targets engine (ropensci/targets#503, @wlandau). Details:
    https://books.ropensci.org/targets/markdown.html.

  * The chunk option cache.globals can take values TRUE and FALSE now (in
    addition to a character vector). When FALSE, it tries to find all symbols
    in the code chunk, no matter if they are local or global variables. When
    NULL or TRUE, it tries to find all global variables (thanks, @knokknok, #
    1898).

MAJOR CHANGES

  * An error is now thrown when an inline code result is not coercible to
    character. This has always been the assumed behavior but it happens to be
    different in certain formats with unknown automatic coercion. This is now
    enforced to prevent any unexpected output. An inline code expression must
    evaluate to a character vector or an object coercible by as.character() (#
    2006).

  * The markdown package has been moved from Imports to Suggests in knitr's
    DESCRIPTION, which means it is no longer a hard dependency but has become a
    soft dependency of knitr (#1864). One consequence for package developers is
    that if you use the vignette engines based on markdown (such as
    knitr::knitr), you will have to explicitly declare the (soft) dependency on
    markdown, because the implicit dependency through knitr is no longer there.

  * For R packages that use the knitr::rmarkdown engine to build their
    vignettes, rmarkdown must be declared as a dependency in the package
    DESCRIPTION (e.g., in Suggests). Previously, knitr would fall back to using
    the markdown package to build vignettes if rmarkdown is not declared (#1864
    , #2020).

  * write_bib() only uses the first URL if multiple are found in a package (#
    2028).

MINOR CHANGES

  * The attribute data-external="1" will be added to <iframe>s generated by
    include_url() to prevent Pandoc from embedding the URL as base64 data
    (thanks, @IndrajeetPatil, https://stackoverflow.com/q/67477667/559676).

  * The chunk option strip.white = TRUE used to work only when the chunk option
    collapse = FALSE. Now the two options are independent, i.e., strip.white
    also works when collapse = TRUE (thanks, @kbvernon, #2011).

  * When building R Markdown vignettes but Pandoc is not available, the
    vignette engine will emit a message instead of a warning before falling
    back to using the markdown package.

  * The internal function is_abs_path() has been removed. Users (if any) should
    use the exported function xfun::is_abs_path() instead.

BUG FIXES

  * Fix an issue with the RStudio IDE when using knitr::include_url() or
    knitr::include_app() in interactive Notebook mode. This will no more cause
    an error but print the list object as is (thanks, @systemnova, #2015).

  * Fix a regression with fig.keep chunk option used in chunks with only one
    figure where the figure was not showing in output (thanks, @fmichonneau, #
    1993).

  * Allow vignettes to be tangled (and output compared) in R CMD check if they
    have a corresponding .Rout.save (thanks, @lentinj, #2018).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants