Skip to content

Register tufte engines in .onLoad()? #117

Closed
@MichaelChirico

Description

@MichaelChirico

Hi all,

We are working on an issue in {lintr} whereby tufte's specific engines are not recognized and thus cause spurious lints / syntax issues: r-lib/lintr#796

We'd like to avoid a solution where we hard-code some information specific to {tufte}, which opens a pandora's box for us to maintain this information not only for {tufte}, but any other engine-generating {knitr} downstreams as well.

The solution we've landed on for {bookdown} is pretty simple -- we need only run loadNamespace("bookdown") and voila! we can use knitr::knit_engines$get() to tell us what engines are registered. See https://github.com/r-lib/lintr/pull/1552/files/94c50f355a53c2d50e0fd8f1be1f99d51531e297

That's because {bookdown} is registering its engines in its .onLoad() hook:

https://github.com/rstudio/bookdown/blob/7b53f2dd7ddb57b7e78ee1575c06b892f549c4e8/R/zzz.R#L4-L6
https://github.com/rstudio/bookdown/blob/7b53f2dd7ddb57b7e78ee1575c06b892f549c4e8/R/utils.R#L589-L594

Is there any disadvantage to doing something similar for the engines {tufte} provides?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions