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

Accessing quarto metadata programmatically via QuartoNotebookWorker #139

Closed
jkrumbiegel opened this issue May 29, 2024 · 7 comments · Fixed by #165
Closed

Accessing quarto metadata programmatically via QuartoNotebookWorker #139

jkrumbiegel opened this issue May 29, 2024 · 7 comments · Fixed by #165

Comments

@jkrumbiegel
Copy link
Collaborator

Now that we have the expand extension pipeline, I was thinking that downstream packages might want to expand differently depending on, for example, the output format that quarto renders to. I think that's different from the loading hooks we currently have. So I wonder how we could make the full quarto metadata accessible, like you can access it from knitr with knitr::pandoc_to(), as one example.

@MichaelHatherly
Copy link
Collaborator

Stored in

const OPTIONS = Ref(Dict{String,Any}())
, so we can make an official API for that I guess.

@jkrumbiegel
Copy link
Collaborator Author

Yes, although there's currently no open way to access anything QNW-related, is there? The extension methods hook in at package load time, you couldn't easily reach that from the notebook itself. And I think we were holding off on adding any API into the notebook workspace due to it not being available in a REPL.

@MichaelHatherly
Copy link
Collaborator

you couldn't easily reach that from the notebook itself. And I think we were holding off on adding any API into the notebook workspace due to it not being available in a REPL.

Would only be accessed in 3rd-parth package extensions, not directly in a notebook, e.g.

module PackageNameQuartoNotebookWorkerExt

import PackageName
import QuartoNotebookWorker

function QuartoNotebookWorker.expand(::PackageName.Foo)
    opts = QuartoNotebookWorker.options() # hypothetical public API, used at runtime.
    # ...
end

end

@jkrumbiegel
Copy link
Collaborator Author

jkrumbiegel commented May 29, 2024

Right, ok, so it should stay that way then. One could not develop such functionality directly within notebooks is the only drawback I can see.

@MichaelHatherly
Copy link
Collaborator

One could not develop such functionality directly within notebooks is the only drawback I can see.

Nope, you can't. Revise ideally should just work with this fine and functionality can just be developed directly in the extension file. If that doesn't work then we should make it work.

@jkrumbiegel
Copy link
Collaborator Author

Yes for "serious" development that's true, it just adds overhead if you want to quickly try out things. I would have liked an "escape hatch" of some kind. Actually, maybe that's already possible by requiring the right UUID manually. Just thinking out loud here, I think the extension is in general the right place to do this kind of stuff.

@MichaelHatherly
Copy link
Collaborator

Actually, maybe that's already possible by requiring the right UUID manually.

Given the way the LOAD_PATH is done you should just be able to always do using QuartoNotebookWorker in a cell as an escape hatch if needed. (Worked for me just now).

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

Successfully merging a pull request may close this issue.

2 participants