Open olgabot opened 4 years ago
I think you can adjust the widths of the ---
in the second row below:
| Citation | Alphabet | Amino acid groups |
|:----------------------------------------------------------------------|:-----------|:--------------------------------------------------------------------------------|
I believe Pandoc uses these to determine column width. From https://pandoc.org/MANUAL.html#extension-pipe_tables
If a pipe table contains a row whose printable content is wider than the column width (see
--columns
), then the table will take up the full text width and the cell contents will wrap, with the relative cell widths determined by the number of dashes in the line separating the table header from the table body. (For example---|-
would make the first column 3/4 and the second column 1/4 of the full text width.) On the other hand, if no lines are wider than column width, then cell contents will not be wrapped, and the cells will be sized to their contents.
So it looks like Pandoc is perhaps writing the HTML that enables wrapping. @vincerubinetti are there HTML classes that can be used to disable wrapping on a certain column?
Ah, interesting. i'm using Atom's markdown-table-formatter package which autoformats based on the contents of the table, and that's probably affecting the output! I'll try turning it off and manually adjusting the table widths
I don't believe we have generic utility wrap
or nowrap
classes in the default theme. Perhaps we should consider it for cases like this.
As Daniel said, adjusting your dash widths will affect how Pandoc sets the % widths of the columns in a table. I'm not sure it's a good idea that Pandoc does that. Maybe we can disable that somehow?
@dhimmel Can we make this issue specifically about table column wrapping, and deferring column width discussions to #254? Maybe rename the issue to suit?
Looking at this again, it's a bit harder than I thought.
We could create some wrap/nowrap util classes, but you'd have to apply them to each cell. And worse, I don't think you'd be able to use the convenient {.class}
markdown/pandoc syntax; you'd have to use our attributes plugin, eg <!-- $class="nowrap" -->
.
I believe there would have to be a special plugin to do this. I don't see a convenient workaround. The best solution I can think of is to add something to the attributes plugin that detects if the attribute is being applied to a table header cell, and then also applies that attribute to all body cells in the same column. But then what if you actually do only want to apply the attribute to the header cell?
Can we make this issue specifically about table column wrapping
Yes I will rename. Reading through this issue, it seems that the issue is primarily with the table layout, and that the layout issues are probably not caused by the presence of citations (besides how their raw forms affected the atom-generated markdown table). I agree it makes sense to consolidate future column width discussion in https://github.com/manubot/rootstock/issues/254.
We can use this issue for column wrapping discussion. For these table issues, it's best if we can track down an upstream pandoc issue where we might be able to nudge along progress or find existing workarounds. I'm not actually sure there is an issue here besides column width, based on Pandoc pipe_tables docs:
If a pipe table contains a row whose Markdown content is wider than the column width (see --columns), then the table will take up the full text width and the cell contents will wrap, with the relative cell widths determined by the number of dashes in the line separating the table header from the table body.
So I think the first thing we need to know is whether the desired behavior can be achieved by setting columns widths. Or whether we can find anything to improve Pandoc's column width settings.
Related: https://github.com/manubot/rootstock/issues/294 https://github.com/manubot/rootstock/issues/254
Hello, I'm working on a PR that includes tables that have inline citations, and this seems to be confusing the PDF and HTML formatters. For example, this table:
Gets rendered in the HTML as:
And in the PDF as:
It seems that there's extra spacing in the first column, which includes a bunch of citations that then get processed to be much narrower. Is there a way to enable word wrap in a particular column (in this case, e.g. the first column)? StackOverflow says that
<br>
can force a line break in the cell, but is there a way to enable word wrap?Here is a google doc that has the kind of spacing I would like:
The second and third columns should not allow word wrapping, but the first column can. Is this possible to specify?
Thank you!