-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Table column widths clarification #7864
Comments
AFAIK, a table's column width unit has never been defined precisely. Pandoc's document AST stores some number between zero and one (to be interpreted as a percentage with 1 being 100%), but it's up to the different writers to do something meaningful with the number, depending on which output format we're writing to (e.g. the HTML writer just outputs CSS |
The number indicates the width of the column relative to the total page width (as defined by The intention is for writers to interpret these widths as relative to page width, not table width. I will fix the Lua documentation. The other issue you raised concerns the HTML writer. Currently we use percentages. I figured these would be interpreted relative to the width of the enclosing container, not the table. And indeed that's what I'm seeing in the browser with a quick test.... So, anything left to do on this? |
Except that usually those html percentages are relative to their parent, here the table... but the browsers adjust/stretch these values anyways... I'll raise a separate issue, or question on discuss board, if I have anything else about that.
Not for the main issue. |
I made a comment last month, but at the wrong place, so it got lost (my bad), so here it is again:
(it could be a "bug" in the docs, or not)
In the Lua filter guide under
ColSpec
, table column width is defined as "a fraction of the total table width". But I've seen it has been corrected elsewhere, in a Haskell context, as "a percentage of the text width".This can be checked with a grid table with one row of two cells, 20 chars wide each, and rendering (eg to
native
) by setting--columns=N
to different values.With N > 40, you get widths inferior to 0.5, diminishing as N increases. With N < 40, you always get 0.5. So the values seem to be percentages relative to the max between page width and table width. (Seems to be confirmed in the code, but I'm no good at Haskell)
That being said, it does make some sense of defining table column widths relative to table width, especially if the Table structure is inspired from HTML for which it is the case... but then again a markdown doc isn't a web page.
This also has a direct incidence on the html writer which directly treats the col widths as relative to the table, which can give weird results if a high N is used for
columns
... but I guess that would be for another issue.So I'd like a clarification of this detail, since setting these values in a filter//custom reader/writer depend upon the interpretation/situation.
The text was updated successfully, but these errors were encountered: