MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / parse_args

Function parse_args

markdown_it/cli/parse.py:82–117  ·  view source on GitHub ↗

Parse input CLI arguments.

(args: Sequence[str] | None)

Source from the content-addressed store, hash-verified

80
81
82def parse_args(args: Sequence[str] | None) -> argparse.Namespace:
83 """Parse input CLI arguments."""
84 parser = argparse.ArgumentParser(
85 description="Parse one or more markdown files, "
86 "convert each to HTML, and print to stdout",
87 # NOTE: Remember to update README.md w/ the output of `markdown-it -h`
88 epilog=(
89 f"""
90Interactive:
91
92 $ markdown-it
93 markdown-it-py [version {__version__}] (interactive)
94 Type Ctrl-D to complete input, or Ctrl-C to exit.
95 >>> # Example
96 ... > markdown *input*
97 ...
98 <h1>Example</h1>
99 <blockquote>
100 <p>markdown <em>input</em></p>
101 </blockquote>
102
103Batch:
104
105 $ markdown-it README.md README.footer.md > index.html
106"""
107 ),
108 formatter_class=argparse.RawDescriptionHelpFormatter,
109 )
110 parser.add_argument("-v", "--version", action="version", version=version_str)
111 parser.add_argument(
112 "--stdin", action="store_true", help="read Markdown from standard input"
113 )
114 parser.add_argument(
115 "filenames", nargs="*", help="specify an optional list of files to convert"
116 )
117 return parser.parse_args(args)
118
119
120def print_heading() -> None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…