data-intuitive / quarto-d2

GNU Affero General Public License v3.0
32 stars 3 forks source link

Add default file format when Quarto format is `typst` #7

Closed elipousson closed 8 months ago

elipousson commented 9 months ago

Happy to open a GitHub issue for discussion but, since this is such a small PR, I thought I'd go ahead and give this a try.

I also added the DarkFlagshipTerrastruct to the list of supported themes (it appeared to be missing but I can reverse that change if I missed something).

elipousson commented 8 months ago

Thanks for the review!

I’ll go back to the file naming code and make sure to document the necessity of the change.

The change is detecting the d2 attribute class also introduce a small bug that I haven’t quite fixed yet.

I’ll get that sorted along with the CHANGELOG in the next week or two. Thanks for a cool extension!

elipousson commented 8 months ago

I think I've almost got it right but I need to work out one more bug. I'll flag when it is ready for review again.

elipousson commented 8 months ago

Dang, I think I've got some good improvements in this PR—support for external d2 files, more consistent handling of output folder paths, and those improvements for Typst output formats—but I'm 100% stuck on getting the raw embeds working again.

If you have a chance to take a look, @rcannood, I'd love to know what I'm doing wrong.

elipousson commented 8 months ago

Finally figured it out: I had an error in how I was writing the control flow in Lua but otherwise it all works as expected. Ready for a second review, I think!

rcannood commented 8 months ago

Happy to see you managed to find the issue! I intended to take a look at it, but didn't manage to find the time.

Could you merge the main branch into yours and move your examples to tests/? Currently the CI will only render the qmds, but it's better than nothing :)

elipousson commented 8 months ago

Added some basic examples to tests (along with a simple d2 file for testing).

I also added some partial support for code folding per the discussion on #6. Code folding will work in HTML output but there are some unresolved formatting issues with d2 code blocks (the gray background doesn't show in the HTML format).

rcannood commented 8 months ago

LGTM!

Thanks @elipousson for making significant changes to the codebase!

Would you like to become a collaborator in this repository?

elipousson commented 8 months ago

@rcannood I'd be happy to! Time permitting, I'd love to figure out how to implement Quarto-style #| block options using https://github.com/coatless-quarto/codecelloptions if you're up for having it added. I also just spotted a typo (mt in the pandoc.insert.mediabag call instead of mimetype) which I can fix directly. I appreciate the invitation and the opportunity to contribute to such a handy extension.