This repository was archived by the owner on Oct 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change 66from mdformat .renderer .typing import Postprocess , Render
77from wcwidth import wcswidth
88
9- _COMPACT_TABLES = False
10- """user-specified flag for toggling compact tables."""
11-
129
1310def 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
3024def _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
You can’t perform that action at this time.
0 commit comments