mmdc 0.2.0__py3-none-any.whl

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.
mmdc/__about__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.2.0"
mmdc/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ from .__about__ import __version__
2
+
3
+ # Export the main converter class
4
+ from .mmdc import MermaidConverter
5
+
6
+ __all__ = ['__version__', 'MermaidConverter']
mmdc/__main__.py ADDED
@@ -0,0 +1,40 @@
1
+ import argparse
2
+ import sys
3
+ import logging
4
+ from pathlib import Path
5
+ from . import MermaidConverter
6
+
7
+ def main():
8
+ parser = argparse.ArgumentParser(
9
+ description="Convert mermaid diagrams to SVG using PhantomJS (phasma)"
10
+ )
11
+ parser.add_argument("-i", "--input", type=Path, required=True, help="Input mermaid file")
12
+ parser.add_argument("-o", "--output", type=Path, required=True, help="Output SVG file")
13
+ parser.add_argument("--timeout", type=int, default=30, help="Timeout in seconds")
14
+ parser.add_argument("--verbose", "-v", action="store_true", help="Enable verbose logging")
15
+
16
+ args = parser.parse_args()
17
+
18
+ # Configure logging
19
+ log_level = logging.DEBUG if args.verbose else logging.INFO
20
+ logging.basicConfig(
21
+ level=log_level,
22
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
23
+ handlers=[
24
+ logging.StreamHandler(sys.stderr)
25
+ ]
26
+ )
27
+
28
+ converter = MermaidConverter()
29
+
30
+ success = converter.convert(args.input, args.output, args.timeout)
31
+ if success:
32
+ logging.info(f"Successfully converted to {args.output}")
33
+ sys.exit(0)
34
+ else:
35
+ logging.error("Conversion failed")
36
+ sys.exit(1)
37
+
38
+
39
+ if __name__ == "__main__":
40
+ main()