aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-07-04 13:35:12 +0200
committerJohn MacFarlane <[email protected]>2022-07-04 13:35:12 +0200
commitf2f9c896eee80d2f7cb60ed7e5d4d27cf2dacd0b (patch)
tree4452bd0d4f8e4d8e1753101ce3a95294d527cd64
parent5df94da83166be812363eff6d3941ad049a55c98 (diff)
Add FAQ on preventing column widths in pipe tables.
See #8139.
-rw-r--r--doc/faqs.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/faqs.md b/doc/faqs.md
index 70d95cfa8..23b2966db 100644
--- a/doc/faqs.md
+++ b/doc/faqs.md
@@ -161,4 +161,29 @@ of the citations by specifying an appropriate CSL bibliography
style using `--csl`
(see [the manual](https://pandoc.org/MANUAL.html#specifying-a-citation-style)).
+### Pandoc adds column widths to pipe tables when any line is wider than the setting for `--columns`. How can I prevent this?
+
+Save this filter as `nowidths.lua` and then pass `--lua-filter
+nowidths.lua` as an additional option to pandoc.
+(See <https://github.com/jgm/pandoc/issues/8139>.)
+
+``` lua
+-- Unset the width attribute of HTML colspecs in tables
+-- See https://github.com/jgm/pandoc/issues/8139
+function Table (tbl)
+ if PANDOC_VERSION[1] >= 2 and PANDOC_VERSION[2] >= 10 then
+ tbl.colspecs = tbl.colspecs:map(function (colspec)
+ local align = colspec[1]
+ local width = nil -- default width
+ return {align, width}
+ end)
+ else
+ for i, w in ipairs(tbl.widths) do
+ tbl.widths[i] = 0
+ end
+ end
+ return tbl
+end
+```
+
:::