Skip to content

Conversation

@QuadnucYard
Copy link
Collaborator

@QuadnucYard QuadnucYard commented May 21, 2025

Features:

  • Relax the judgement for tables (grid, table), special rows (header, footer), and special cells (cell, hline, vline), without requiring prefixes (grid., table.). Treat spread args as special cells. This is expected to introduce more false positives, since we do not rely on a language service that checks function signatures at runtime. Maybe users can utilize this feature for custom tables.
  • Format header and footer as tables. Their column number derives from the container.
  • When there is any special cell, do not reflow cells even if the column number is determined. We preserve your grid structure.
  • Format tables with line comments (but not block comments). A line comment always occupies an entire line instead of attaching.

Incapable cases are reduced to

  • Containing any block comment
  • No positional args. It can be bad under grid layout.

Related issues:

@github-actions
Copy link

github-actions bot commented May 21, 2025

📊 Benchmark Performance Report

group                        base                                   pr
-----                        ----                                   --
pretty-cetz-manual           1.00    951.2±8.47µs        ? ?/sec    1.01    961.1±6.03µs        ? ?/sec
pretty-codly                 1.00  1973.5±18.37µs        ? ?/sec    1.01  1990.1±27.10µs        ? ?/sec
pretty-cpe                   1.04     14.0±0.37ms        ? ?/sec    1.00     13.4±0.68ms        ? ?/sec
pretty-fletcher-diagram      1.00    563.4±8.00µs        ? ?/sec    1.00    564.2±7.45µs        ? ?/sec
pretty-fletcher-draw         1.00  1367.0±14.79µs        ? ?/sec    1.02  1387.8±12.82µs        ? ?/sec
pretty-tablex                1.00      3.6±0.02ms        ? ?/sec    1.02      3.7±0.02ms        ? ?/sec
pretty-touying-core          1.00      2.4±0.08ms        ? ?/sec    1.01      2.4±0.02ms        ? ?/sec
pretty-touying-utils         1.00   1315.2±9.65µs        ? ?/sec    1.01  1332.1±12.99µs        ? ?/sec
pretty-undergraduate-math    1.01  1023.8±17.89µs        ? ?/sec    1.00  1018.1±22.83µs        ? ?/sec

Generated by GitHub Actions on Thu May 22 14:45:07 UTC 2025

@QuadnucYard
Copy link
Collaborator Author

This prepares for table alignment.

For better visualization, it is better to put cells in a row on a single line, even if they are too long.
However, if any cell in a row is multiline, that is worse than putting each cell on an individual line.
In this case, break-suppressing will not help.

We may limit table alignment to cases where cells in the row are all single-line.

@QuadnucYard QuadnucYard force-pushed the better-table branch 3 times, most recently from 224a54a to 66eb3a2 Compare May 22, 2025 10:14
Copy link
Collaborator

@Enter-tainer Enter-tainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall LGTM

@QuadnucYard QuadnucYard merged commit 706d0f6 into typstyle-rs:master May 22, 2025
15 checks passed
@QuadnucYard QuadnucYard deleted the better-table branch May 22, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat imported header same as table.header

2 participants