Replies: 2 comments
-
Sorry guys, I opened this in the wrong repo, will close and open in the correct repo |
Beta Was this translation helpful? Give feedback.
0 replies
-
You shouldn't need pre-render scripts or temp files for any of this (note that pre-render scripts only work in projects anyway). You should use the HTML dependencies API to inject the dependencies and scripts you need: https://quarto.org/docs/extensions/lua-api.html#dependencies |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
Pre-render lua script is not running.
Hey guys, here's my problem, i have a very basic lua script that at the moment is just a "hello world" that is supposed to create an output.txt file and inject "hello world". However, when i run
quarto render template.qmd
it doesn't runhowever if i run
quarto run _extensions/qreact/find-react-components.lua
it works as expected. Is there some condition where pre render doesn't always execute its scripts?EDIT: I forgot to add, it is defined in the extension yml under pre-render here
What I am trying to achieve
I'm looking at the feasibility of creating an extention that injects React components using a custom extension. You can find it here
It essentially follows the process defined in the documentation to create a custom format
The idea being that
A pre-render script is used to look for a React shortcode, in the md/qmd, replacing the shortcode to be just a div with a unique id for injecting the react component later. Then creating a list of components to "render" with their corresponding div ids, and saving the list to a tmp file,
A include-header script that inject the correct React dependencies (react.min ect)
and another include-header that reads through the tmp file we created earlier, finding the user's
components
and essentially dumping them in a header script. then for each one, injecting div id to the ReactDOM.render call. EG:Beta Was this translation helpful? Give feedback.
All reactions