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

Are remote themes possible? #103

Closed
zkamvar opened this issue Sep 2, 2021 · 3 comments
Closed

Are remote themes possible? #103

zkamvar opened this issue Sep 2, 2021 · 3 comments
Assignees
Milestone

Comments

@zkamvar
Copy link

zkamvar commented Sep 2, 2021

I'm currently working on a re-working of The Carpentries lesson infrastructure to be more portable and easier to work with by separating the components for building, styling, and validation so that the tools could be updated independently of the lesson contents.

One of the methods I've used to do this is a {pkgdown}-style approach that allows for alternative HTML, CSS, and JS bundled in a separate package that can be independently updated, aka a remote theme.

I would really like to use quarto under the hood for our infrastructure, but the theming seems to be limited to modifying CSS. Is it possible to include HTML templates from a remote source?

@jjallaire
Copy link
Collaborator

Pandoc has a pretty robust mechanism for creating custom templates, and I believe that templates can be loaded from remote URLs. For example:

---
title: "Remote Template"
template: https://raw.githubusercontent.com/jgm/pandoc-templates/master/default.html5
---

This is a Quarto document. To learn more about Quarto visit <https://quarto.org>.

The URL above points to the default pandoc HTML template. Here are the docs on developing custom pandoc templates:

https://pandoc.org/MANUAL.html#templates

The most straightforward thing to do would be bundle all JS and CSS within the HTML template. Should this become unwieldy I believe there is a system of template partials you can use for more modular composition. For example here is the common HTML styles template that all of the pandoc HTML formats include:

https://github.com/jgm/pandoc-templates/blob/master/styles.html

This would enable you to maintain fully remote core templates. If users needed an offline authoring experience they could also certainly download the template. Another approach would be to assume offline/downloads but just have a single script used to sync the templates.

If you end up getting into Lua filters (https://pandoc.org/filters.html) then you'll almost certainly want to take the approach of a script that syncs down the template and the filters (and other assets).

This is basically rolling your own simple "package manager" that just downloads and unzips files into an e.g template directory. We will be working on a Quarto extension system that will provide similar capabilities but I'm not 100% sure when that will land (likely within 6-9 months). Note also that our extensions might start out being zip files and then get package manager capabilities (including possibly bundling them inside R and/or Python packages) later on.

If you can survive with just a single pandoc template referenced remotely that is obviously the simplest and most straightforward solution. Not sure if this is practical for your use case though.

@jjallaire
Copy link
Collaborator

We expect that extensions and custom formats (to be released soon) should accommodate these requirements. More soon!

@jjallaire jjallaire added this to the 1.0 milestone Jun 9, 2022
@jjallaire jjallaire modified the milestones: 1.0, Formats Jun 21, 2022
@dragonstyle
Copy link
Collaborator

Extension documentation is now available at:

https://quarto.org/docs/extensions/

Thanks!

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

3 participants