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

Commit e7a5a08

Browse files
committed
Remove global variable
1 parent 17e7913 commit e7a5a08

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

mdformat_tables/plugin.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from mdformat.renderer.typing import Postprocess, Render
77
from wcwidth import wcswidth
88

9-
_COMPACT_TABLES = False
10-
"""user-specified flag for toggling compact tables."""
11-
129

1310
def add_cli_options(parser: argparse.ArgumentParser) -> None:
1411
"""Add options to the mdformat CLI, to be stored in `mdit.options["mdformat"]`."""
@@ -23,9 +20,6 @@ def update_mdit(mdit: MarkdownIt) -> None:
2320
"""Update the parser, e.g. by adding a plugin: `mdit.use(myplugin)`"""
2421
mdit.enable("table")
2522

26-
global _COMPACT_TABLES
27-
_COMPACT_TABLES = mdit.options["mdformat"].get("compact_tables", False)
28-
2923

3024
def _lpad(text: str, width: int) -> str:
3125
indent = width - wcswidth(text)
@@ -98,7 +92,7 @@ def _render_table(node: RenderTreeNode, context: RenderContext) -> str:
9892

9993
def _calculate_width(col_idx: int) -> int:
10094
"""Work out the widths for each column."""
101-
if _COMPACT_TABLES:
95+
if context.options["mdformat"].get("compact_tables", False):
10296
return 0
10397
return max(3, *(wcswidth(row[col_idx]) for row in rows))
10498

0 commit comments

Comments
 (0)