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

Generate book version #4

Open
arnold-c opened this issue Jul 15, 2024 · 1 comment
Open

Generate book version #4

arnold-c opened this issue Jul 15, 2024 · 1 comment

Comments

@arnold-c
Copy link

arnold-c commented Jul 15, 2024

This may not be worthwhile (or particularly easy), but I wonder if it would be nice to provide a mechanism by which the user can specify if they want the docs to be served as a book or a website? The benefit of rendering a book is that you gain cross-referencing functionality, as well as producing a left sidebar that mirrors the predominant layout of most Julia documentation sites, making for potentially more familiar and easier user navigation.

It would likely be possible to keep much of the code as-is and use multiple dispatch to render the book/website specific pages with some custom structs.

# types.jl
abstract type QuartoDocument
struct QuartoWebsite <: QuartoDocument end
struct QuartoBook <: QuartoDocument end

# build.jl
function quarto_yaml(
  module_name, ::QuartoWebsite;
  ;freeze = "auto"
  ,cache = "true"
  ,warning = "false"
  ,project_type = "website"
  ,output_dir = "_site"

  ,comments = "true"
  ,repo = "USERNAME/REPOSITORY"

  ,theme = "flatly"
  )
...
end

function quarto_yaml(
  module_name, ::QuartoBook
  ;freeze = "auto"
  ,cache = "true"
  ,warning = "false"
  ,project_type = "book"
  ,output_dir = "_book"

  ,comments = "true"
  ,repo = "USERNAME/REPOSITORY"

  ,theme = "flatly"
  )
...
end

Feel free to ignore if this is out of scope/too much work, but wanted to suggest just in case it was helpful

@vituri
Copy link
Owner

vituri commented Jul 16, 2024

Good point! I often use the book format when preparing workshops, and it is a good use for documentations. What other changes do I need to make at the _quarto.yaml besides changing the type of project?

I am asking because if all that is needed is to change type: website to type: book, then it is easier to edit the generated _quarto.yaml template "by hand" than to use another function and dispatch, as you suggest. In any case you have to edit this file to add more qmd files, so you already need to have some knowledge of Quarto. What do you think?

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