Is it possible to create a stand-alone HTML (quarto) document that still has Observable JS interactivity? It is not working for me, in that the resulting HTML does not have the proper formatting and is not interactive. I am using the standalone
YAML code:
format:
html:
embed-resources: true
This line in the documentation made it sound like it might be possible, but I don't know what it means by core libraries
:
Additionally, you can use Observable JS (“OJS”) in standalone documents and websites via its core libraries .
Thanks, Roger
cderv
August 31, 2023, 11:52am
2
rogerjbos:
embed-resources
This feature does not work when OJS cell. This is a constraint due to how OJS is working.
You can follow here for possible future resolution
opened 06:34PM - 28 Jul 23 UTC
closed 02:26PM - 22 Nov 23 UTC
enhancement
wontfix
### Discussed in https://github.com/quarto-dev/quarto-cli/discussions/5680
<d… iv type='discussions-op-text'>
<sup>Originally posted by **harrylojames** May 25, 2023</sup>
> After doing "quarto render file.qmd --to html" I am unable to double click and view the html file. Here is the error. It does as stated work from a web server i.e. with preview.
>
> "The OJS runtime does not work with file:// URLs. Please use a web server to view this document."
>
...</div>
After some experimenting, I found out that if I embed resources and manually remove the JavaScript code that tests for file:// URL from the resulting HTML, I get a fully functional, interactive, ObservableJS-enabled document. I think it is logical this works - the file:// URLs disable loading files saved next to the document, but once those resources get embedded, the resulting .html file works ok.
This functionality is very important for us, as we rely on it to deliver "self-contained" html documents to our clients, that can be viewed and interacted with independently on any software they might have installed on their machines. It is not realistic for us to teach them how to run local webservers just so they can look at our files.
I propose a fix that would disable the `file://` URL checking code in case quarto is running in `embed-resources` mode. Otherwise I can keep using Quarto, but I'd have to pass every file being generated through a small `sed` script that would yank the offending JavaScript, which is quite inconvenient.
I am not familiar with the codebase, but I'll try to take a shot at a PR, as this is unfortunately a show-stopper for us.
system
Closed
October 12, 2023, 11:52am
3
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.