Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 00db791

Browse files
committed
Don't fetch compact_tables option for each column
1 parent e7a5a08 commit 00db791

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mdformat_tables/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def format_delimiter_cell(index: int, align: str) -> str:
7070

7171
def _render_table(node: RenderTreeNode, context: RenderContext) -> str:
7272
"""Render a `RenderTreeNode` of type "table"."""
73+
compact_tables = context.options["mdformat"].get("compact_tables", False)
7374
# gather rendered cell content into row * column array
7475
rows: List[List[str]] = []
7576
align: List[List[str]] = []
@@ -92,7 +93,7 @@ def _render_table(node: RenderTreeNode, context: RenderContext) -> str:
9293

9394
def _calculate_width(col_idx: int) -> int:
9495
"""Work out the widths for each column."""
95-
if context.options["mdformat"].get("compact_tables", False):
96+
if compact_tables:
9697
return 0
9798
return max(3, *(wcswidth(row[col_idx]) for row in rows))
9899

0 commit comments

Comments
 (0)