-
Notifications
You must be signed in to change notification settings - Fork 3
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
ENH Suggestion: Return the code as well as the diagram #6
Comments
Is the echo parameter what you are looking for? (See https://github.com/data-intuitive/quarto-d2?tab=readme-ov-file#attributes) |
@rcannood Beautiful - I didn't see that. So I just gave it a whirl and the code returns which is great, but it doesn't seem to respect Quarto's |
I see -- |
* Add default SVG format for Typst output Also add DarkMauve and DarkFlagshipTerrastruct as explicit theme options * Remove duplicate theme DarkMauve was already in the theme list * Allow uppercase layout values Also: - Adds is_nonempty_string helper function - Appends random number for diagram file name - Use d2 file extension not txt for input - Allow alternate syntax for attribute classes on code blocks * Fix d2 class check Also: - Add support for reading d2 diagrams from external files using `file` parameter. Block text is ignored if file parameter is supplied. - Add support for alternate code block syntax without curly braces. - Insert rendered diagrams into the Pandoc mediabag when `embed_type="link"` - Refactor to add helper functions `setPreD2RenderOptions` and `setD2RenderFormat` * Update CHANGELOG.md * Use d2-render instead of svg-convert for temp directory * Add support for gif format Also - add animate_interval parameter - drop setD2RenderFormat helper function - use quarto.project.output_directory to set default folder - revise check for d2 code block class - replace codeblock text if file is provided - add support for tala layout * Use outputPath (not mediabag) if folder is supplied * Update README * Fix typo * Fix error in inline embedding logic * Add check for d2 or txt file extension in file option Also: - add check to see if file exists - Improve handling of code block formatting (when echo=true) - remove duplicative processing for options.pad and options.animate_interval * Update README * Add partial support for code folding (#6) Based on https://github.com/shafayetShafee/add-code-files * Add typst format tests w/ multiple diagram formats Also add external d2 file to test file argument * Update CHANGELOG.md --------- Co-authored-by: Robrecht Cannoodt <[email protected]>
* Add default SVG format for Typst output Also add DarkMauve and DarkFlagshipTerrastruct as explicit theme options * Remove duplicate theme DarkMauve was already in the theme list * Allow uppercase layout values Also: - Adds is_nonempty_string helper function - Appends random number for diagram file name - Use d2 file extension not txt for input - Allow alternate syntax for attribute classes on code blocks * Fix d2 class check Also: - Add support for reading d2 diagrams from external files using `file` parameter. Block text is ignored if file parameter is supplied. - Add support for alternate code block syntax without curly braces. - Insert rendered diagrams into the Pandoc mediabag when `embed_type="link"` - Refactor to add helper functions `setPreD2RenderOptions` and `setD2RenderFormat` * Update CHANGELOG.md * Use d2-render instead of svg-convert for temp directory * Add support for gif format Also - add animate_interval parameter - drop setD2RenderFormat helper function - use quarto.project.output_directory to set default folder - revise check for d2 code block class - replace codeblock text if file is provided - add support for tala layout * Use outputPath (not mediabag) if folder is supplied * Update README * Fix typo * Fix error in inline embedding logic * Add check for d2 or txt file extension in file option Also: - add check to see if file exists - Improve handling of code block formatting (when echo=true) - remove duplicative processing for options.pad and options.animate_interval * Update README * Add partial support for code folding (#6) Based on https://github.com/shafayetShafee/add-code-files * Add typst format tests w/ multiple diagram formats Also add external d2 file to test file argument * Update CHANGELOG.md * fix typo (mt instead of mimetype) Also reorder early return when file + cb text are nil * Add `setD2outputPath` helper Also: - Simplify flow for setting mimetype - rename setPreD2RenderOptions to setD2Options - Protect against filename values w/ file extension - Use assert consistently for errors - Simplify flow for returning data or outputPath * Correct typo in check for pdf format * Fix typo in setD2outputPath Also fixes issue w/ broken links inside Quarto projects + error outside of Quarto projects --------- Co-authored-by: Robrecht Cannoodt <[email protected]>
This is a great addition to the ecosystem, thank you!
Is there a relatively easy way to retain the code so the code and the image are both viewable? Ideally I'd like to have the code in a folded code block as per other types of code. Do you think it would it be relatively straightforward to add this?
Thanks,
zach cp
The text was updated successfully, but these errors were encountered: