Skip to content
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

Handle Pandoc change in table classes #10906

Merged
merged 10 commits into from
Sep 30, 2024
Merged

Handle Pandoc change in table classes #10906

merged 10 commits into from
Sep 30, 2024

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Sep 27, 2024

Fix #10904
Close #10607

This reverts part of commit dd6717f.

The .table is set by quarto itself and its removal in html output is a sign that something has changed and it is not set correctly anymore.

We restore original test to correctly fix this.

See details explanation of current situation at

Opening this PR as a draft with first idea to put back the odd, even and header class on tables that are parsed directly by Pandoc.

We could also find other solution with new approach to serve the same purpose (identifying pandoc's table to style them)

This PR includes snapshot test with playwright so that we can detect next time when the look of the tables are changing.

(BTW this is a first version of snapshot testing with playwright - it could be quite heavy to commit each png, so we could also have something different by leveraging caching in CI: (1) git ignore the __screenshot__ folder, and (2) cache it on CI so that each news runs can access the snapshot. )

@cderv
Copy link
Collaborator Author

cderv commented Sep 27, 2024

Test passes locally. But I should have guessed that first try with this feature would not work on CI. Probably this need to be OS specific.
Or even environment specific and so using caching on CI method only.

I'll debug this.

@cscheid
Copy link
Collaborator

cscheid commented Sep 27, 2024

We need to have a longer conversation about this. The filter you suggested is a good idea, except (as I understand it) that it will trigger on all tables, not just those that Pandoc itself parsed, and that is a problem with (eg) our html table processing.

@cderv
Copy link
Collaborator Author

cderv commented Sep 27, 2024

The filter you suggested is a good idea, except (as I understand it) that it will trigger on all tables, not just those that Pandoc itself parsed, and that is a problem with (eg) our html table processing.

Then it is on me and my incorrect understanding of how our filter chain works. I specifically added early in normalize step so that it applies first in AST for any Table parsed by Pandoc, and I paid attention to place this filter specifically before the HTML parsing we do. If this is not what it will do (I did not check yet other tables), then I think I don't understand completely the different layers of the filter chain and its ordering. (some errors in CI show me I am still missing some things for sure)

To be clear, my intention is to apply specifically on Pandoc parsed Table only, and avoid our parsed HTML table.

And I did as a draft so that we have a base to discuss on. So 💯 for discussion. 👍

@cscheid
Copy link
Collaborator

cscheid commented Sep 27, 2024

I specifically added early in normalize step so that it applies first in AST for any Table parsed by Pandoc, and I paid attention to place this filter specifically before the HTML parsing we do

Nope, that's on me, I wrote too fast!

@cderv cderv linked an issue Sep 30, 2024 that may be closed by this pull request
This reverts part of commit dd6717f.

The `.table` is set by quarto itself and its removal in html output is a sign that something has changed and it is not set correctly anymore.

We restore original test to correctly fix this.
It has its own loading different than main.lua one.
@cderv cderv force-pushed the fix/table-style-new-pandoc branch 4 times, most recently from cedf9c5 to 84cb8dc Compare September 30, 2024 10:17
CI needs to be adapted to correctly run visual tests.
@cderv
Copy link
Collaborator Author

cderv commented Sep 30, 2024

Regarding visual testing with playwright, it requires an update in our GHA workflows so that we can have working tests. Right now, it works locally but we have pixels differences between local and CI, even on same OS (linux for example).

So I'll handle the update of CI in another workflow. Maybe it will be easier to run playwright tests, out of smoke-all runs and parallel testing to simplify the conditional and configuration.

@cderv cderv marked this pull request as ready for review September 30, 2024 12:20
@cderv
Copy link
Collaborator Author

cderv commented Sep 30, 2024

@cscheid following our call, I have updated to do the change as HTML fixup in post render to match more closely previous Pandoc's behavior

@cscheid
Copy link
Collaborator

cscheid commented Sep 30, 2024

This is excellent too.

@cscheid cscheid merged commit b7d0ddd into main Sep 30, 2024
47 checks passed
@cscheid cscheid deleted the fix/table-style-new-pandoc branch September 30, 2024 20:46
cderv added a commit that referenced this pull request Nov 8, 2024
Follow up on #10906 which was incomplete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants