Skip to content

[FR] Add a new type of dependency that bundles lua filter and other type of dependencies #2347

Closed

Description

@cderv

We are more more adding feature based on Lua filters, and they often require to have other dependencies added like CSS or JS, but it could even be LaTeX dependencies.

Currently, we need to do that by creating dependencies in several object and then adding them at the right place in the output format.

I have a secret wish to a way to have a feature extensions bundle where we have a htmlDependency() with a Lua filter requirements. Something that we could write in a wrapped way, and that rmarkdown could unwrapped and use the correct way. We don't have a lua_dependency component, and maybe that would make sense to have at some point adding more feature like this

lua_dependency(
	filters = "code-folding-lua",
    html_deps = htmlDependency(
    	"codefolding-lua",
	    version = "1.1",
    	src = pkg_file("rmd/h/navigation-1.1"),
	    stylesheet = "codefolding-lua.css",
    	all_files = FALSE
  )
}

We could then group some features.

It could also be more generic like an rmd_dependency() (suggestion of @atusy) and could indeed probably be interesting if we considered it would bundle everything

rmd_dependency(
  filters = # lua filters
  html_deps = # htmlDepedency()
  latex_deps = # latex_dependencies()
)

This way a feature could be grouped with all its component. This could also be extended to knitr to support having a lua filter as part of dependencies to add, working the same as with HTML deps or LaTeX deps with knitr::knit_meta()

It would not help make things works better, but I feel it would makes this cleaner, the same way JS and CSS are grouped for an HTML deps.

Originally posted by @cderv in #2340 (comment)

Activity

  1. added
    feature
    on Apr 11, 2022
  2. yihui commented on Apr 11, 2022

    @yihui
    Collaborator

    That sounds like a great idea to me!

  3. atusy commented on Feb 8, 2023

    @atusy
    Collaborator

    I'm currently working on this.

    Some thoughts:

    To make things simple yet powerful, I would add pandoc_dependency rather than lua_dependency.
    Then, we can also control metadata and variables.
    I also guess there are some usecases where to add metadata or variables but no lua filters.
    In such cases, the name lua_dependency is not adequate.

    pandoc_dependency(
      lua_filters,
      metadata,
      variables,
      ... # can be more?
    )

    Of course, we can still add rmd_dependency which allows declare variety of dependencies at once.
    I think we do not need _deps suffix as it is obvious from the function name.

    rmd_dependency(
      pandoc # pandoc_dependency
      html # htmlDependency
      latex # latex_dependency
    )
  4. cderv commented on Feb 8, 2023

    @cderv
    CollaboratorAuthor

    I'm currently working on this.

    Cool ! Thank you !

    To make things simple yet powerful, I would add pandoc_dependency rather than lua_dependency.

    Really interesting ! Yes I like that idea. Let's try with that !

  5. moved this from Backlog to Todo In Progress in R Markdown Team Projectson Feb 8, 2023
  6. moved this from Todo In Progress to Next / Ready for Dev in R Markdown Team Projectson Mar 28, 2023
  7. moved this from Next / Ready for Dev to Todo In Progress in R Markdown Team Projectson May 23, 2023
  8. linked a pull request that will close this issueAdd output_format_dependency() #2462on May 23, 2023
  9. moved this from Todo In Progress to Done in R Markdown Team Projectson Jul 11, 2023
  10. github-actions commented on Jan 10, 2024

    @github-actions

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

  11. locked as resolved and limited conversation to collaborators on Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions