-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat: handle cols_width differently in Quarto environment #603
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #603 +/- ##
==========================================
- Coverage 90.71% 90.39% -0.33%
==========================================
Files 46 46
Lines 5417 5443 +26
==========================================
+ Hits 4914 4920 +6
- Misses 503 523 +20 ☔ View full report in Codecov by Sentry. |
Thanks Carlos! Will review soon :) |
Thanks for taking the time to look into this and submit a PR! I noticed it...
This seems a bit tricky to remember (e.g. "if I'm using quarto...", "if all widths are set...", "other option behavior set otherwise..."). What if we fired a warning instead?
That way there's less risk of us blasting options users set, and they hopefully can to resolve the issue even when not all col widths are set. WDYT. |
Thanks for the response!
I confirm that's the behavior I intended to implement. The reason is that we can only do the conversion to percentages if we know what the total width is intended to be. I agree that this doesn't cover the range of possible behaviors in HTML, but it covers the range of behavior that Pandoc understands.
I like it, but there are some tricky state transitions to think through. Disabling or enabling Quarto processing can be done after the column widths are set. So, for example, a user can, in principle, in the following order:
This would cause no warnings and yet would render a table that Pandoc will eventually incorrectly process. I'll give |
How do you want me to handle testing for this? |
Users could also accidentally disable the things this PR sets in I suspect our best bet is not to try and set quarto based workarounds, but to warn users right around when the bad behaviors are produced. For example, we could run a set of quarto specific warnings at render time. What do you think of us not automatically setting any options, but running quarto-specific warning checks at render (or just before, whenever lets us detect more surprising GT x quarto behaviors)? |
Summary
This PR adds special handling to
cols_width
when running in Quarto, so that Pandoc knows how to parse column width information.I haven't added a
pytest
test yet because I'm unsure of how you prefer to test Quarto-specific functionality. Locally, I've tested by mocking a Quarto environment, lying aboutQUARTO_BIN_PATH
. I've also done an integration test and can confirm the feature runs. But I'd like to add explicit tests.Related GitHub Issues and PRs
Checklist