mdformat-space-control 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdformat_space_control
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: An mdformat plugin for space control: EditorConfig indentation, tight lists, frontmatter spacing, smart dash conversion, explicit line breaks, and wikilinks.
5
5
  Project-URL: Homepage, https://github.com/jdmonaco/mdformat-space-control
6
6
  Author-email: Joseph Monaco <joe@selfmotion.net>
@@ -1,6 +1,6 @@
1
1
  """An mdformat plugin for space control: EditorConfig indentation, tight lists, frontmatter spacing, smart dash conversion, soft break joining, and wikilinks."""
2
2
 
3
- __version__ = "0.4.2"
3
+ __version__ = "0.4.3"
4
4
 
5
5
  from .config import (
6
6
  get_current_file,
@@ -411,6 +411,9 @@ def _convert_dash_sequences(text: str) -> str:
411
411
  em_dash_re = re.compile(r"(?<!-)---(?!-)")
412
412
  en_dash_re = re.compile(r"(?<!-)--(?!-)")
413
413
 
414
+ # CLI option pattern: --word or ---word preceded by whitespace or line start
415
+ cli_option_re = re.compile(r"(?<=\s)-{2,3}(?=\w)")
416
+
414
417
  # Lines that are only dashes (thematic breaks, frontmatter delimiters)
415
418
  only_dashes_re = re.compile(r"^-{2,}\s*$")
416
419
 
@@ -453,6 +456,9 @@ def _convert_dash_sequences(text: str) -> str:
453
456
  protected = html_comment_re.sub(_save_placeholder, protected)
454
457
  protected = html_tag_re.sub(_save_placeholder, protected)
455
458
 
459
+ # Protect CLI option dashes (e.g., --output, ---long-opt)
460
+ protected = cli_option_re.sub(_save_placeholder, protected)
461
+
456
462
  # Convert em-dash first (longer match), then en-dash
457
463
  protected = em_dash_re.sub("\u2014", protected)
458
464
  protected = en_dash_re.sub("\u2013", protected)