all2md 1.0.1__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.
Files changed (223) hide show
  1. all2md/__init__.py +303 -0
  2. all2md/__main__.py +13 -0
  3. all2md/_plaintext-exts.json +199 -0
  4. all2md/api.py +1095 -0
  5. all2md/ast/__init__.py +218 -0
  6. all2md/ast/builder.py +674 -0
  7. all2md/ast/nodes.py +2147 -0
  8. all2md/ast/sections.py +1095 -0
  9. all2md/ast/serialization.py +1018 -0
  10. all2md/ast/splitting.py +802 -0
  11. all2md/ast/transforms.py +1574 -0
  12. all2md/ast/utils.py +169 -0
  13. all2md/ast/visitors.py +1163 -0
  14. all2md/cli/__init__.py +320 -0
  15. all2md/cli/builder.py +2347 -0
  16. all2md/cli/commands/__init__.py +141 -0
  17. all2md/cli/commands/completion.py +479 -0
  18. all2md/cli/commands/config.py +505 -0
  19. all2md/cli/commands/diff.py +273 -0
  20. all2md/cli/commands/formats.py +500 -0
  21. all2md/cli/commands/generate_site.py +178 -0
  22. all2md/cli/commands/help.py +52 -0
  23. all2md/cli/commands/search.py +963 -0
  24. all2md/cli/commands/server.py +877 -0
  25. all2md/cli/commands/shared.py +542 -0
  26. all2md/cli/commands/themes/dark.html +210 -0
  27. all2md/cli/commands/themes/docs.html +283 -0
  28. all2md/cli/commands/themes/minimal.html +173 -0
  29. all2md/cli/commands/themes/newspaper.html +236 -0
  30. all2md/cli/commands/themes/sidebar.html +301 -0
  31. all2md/cli/commands/transforms.py +166 -0
  32. all2md/cli/commands/view.py +201 -0
  33. all2md/cli/config.py +484 -0
  34. all2md/cli/custom_actions.py +673 -0
  35. all2md/cli/help_formatter.py +825 -0
  36. all2md/cli/input_items.py +124 -0
  37. all2md/cli/output.py +84 -0
  38. all2md/cli/packaging.py +138 -0
  39. all2md/cli/presets.py +281 -0
  40. all2md/cli/processors.py +2902 -0
  41. all2md/cli/progress.py +317 -0
  42. all2md/cli/timing.py +308 -0
  43. all2md/cli/validation.py +187 -0
  44. all2md/cli/watch.py +362 -0
  45. all2md/constants.py +1270 -0
  46. all2md/converter_metadata.py +319 -0
  47. all2md/converter_registry.py +949 -0
  48. all2md/dependencies.py +729 -0
  49. all2md/diff/__init__.py +43 -0
  50. all2md/diff/renderers/__init__.py +41 -0
  51. all2md/diff/renderers/html.py +442 -0
  52. all2md/diff/renderers/json.py +200 -0
  53. all2md/diff/renderers/unified.py +113 -0
  54. all2md/diff/text_diff.py +565 -0
  55. all2md/exceptions.py +628 -0
  56. all2md/logging_utils.py +57 -0
  57. all2md/mcp/__init__.py +41 -0
  58. all2md/mcp/__main__.py +17 -0
  59. all2md/mcp/config.py +479 -0
  60. all2md/mcp/document_tools.py +431 -0
  61. all2md/mcp/schemas.py +211 -0
  62. all2md/mcp/security.py +347 -0
  63. all2md/mcp/server.py +316 -0
  64. all2md/mcp/tools.py +375 -0
  65. all2md/options/__init__.py +131 -0
  66. all2md/options/archive.py +169 -0
  67. all2md/options/asciidoc.py +240 -0
  68. all2md/options/ast_json.py +92 -0
  69. all2md/options/base.py +162 -0
  70. all2md/options/bbcode.py +116 -0
  71. all2md/options/chm.py +62 -0
  72. all2md/options/common.py +697 -0
  73. all2md/options/csv.py +329 -0
  74. all2md/options/docx.py +237 -0
  75. all2md/options/dokuwiki.py +188 -0
  76. all2md/options/eml.py +203 -0
  77. all2md/options/enex.py +183 -0
  78. all2md/options/epub.py +169 -0
  79. all2md/options/fb2.py +60 -0
  80. all2md/options/html.py +541 -0
  81. all2md/options/ini.py +108 -0
  82. all2md/options/ipynb.py +276 -0
  83. all2md/options/jinja.py +284 -0
  84. all2md/options/json.py +163 -0
  85. all2md/options/latex.py +206 -0
  86. all2md/options/markdown.py +701 -0
  87. all2md/options/mbox.py +132 -0
  88. all2md/options/mediawiki.py +195 -0
  89. all2md/options/mhtml.py +31 -0
  90. all2md/options/odp.py +209 -0
  91. all2md/options/ods.py +43 -0
  92. all2md/options/odt.py +183 -0
  93. all2md/options/openapi.py +156 -0
  94. all2md/options/org.py +246 -0
  95. all2md/options/outlook.py +150 -0
  96. all2md/options/pdf.py +695 -0
  97. all2md/options/plaintext.py +137 -0
  98. all2md/options/pptx.py +389 -0
  99. all2md/options/rst.py +218 -0
  100. all2md/options/rtf.py +86 -0
  101. all2md/options/search.py +200 -0
  102. all2md/options/sourcecode.py +69 -0
  103. all2md/options/textile.py +145 -0
  104. all2md/options/toml.py +147 -0
  105. all2md/options/webarchive.py +75 -0
  106. all2md/options/xlsx.py +29 -0
  107. all2md/options/yaml.py +164 -0
  108. all2md/options/zip.py +162 -0
  109. all2md/parsers/__init__.py +20 -0
  110. all2md/parsers/archive.py +1519 -0
  111. all2md/parsers/asciidoc.py +2003 -0
  112. all2md/parsers/ast_json.py +244 -0
  113. all2md/parsers/base.py +398 -0
  114. all2md/parsers/bbcode.py +1012 -0
  115. all2md/parsers/chm.py +470 -0
  116. all2md/parsers/csv.py +535 -0
  117. all2md/parsers/docx.py +1756 -0
  118. all2md/parsers/dokuwiki.py +1251 -0
  119. all2md/parsers/eml.py +1192 -0
  120. all2md/parsers/enex.py +674 -0
  121. all2md/parsers/epub.py +290 -0
  122. all2md/parsers/fb2.py +639 -0
  123. all2md/parsers/html.py +2286 -0
  124. all2md/parsers/ini.py +323 -0
  125. all2md/parsers/ipynb.py +752 -0
  126. all2md/parsers/json.py +554 -0
  127. all2md/parsers/latex.py +1061 -0
  128. all2md/parsers/markdown.py +1060 -0
  129. all2md/parsers/mbox.py +591 -0
  130. all2md/parsers/mediawiki.py +951 -0
  131. all2md/parsers/mhtml.py +242 -0
  132. all2md/parsers/odp.py +881 -0
  133. all2md/parsers/ods_spreadsheet.py +601 -0
  134. all2md/parsers/odt.py +659 -0
  135. all2md/parsers/openapi.py +972 -0
  136. all2md/parsers/org.py +1056 -0
  137. all2md/parsers/outlook.py +760 -0
  138. all2md/parsers/pdf.py +4116 -0
  139. all2md/parsers/plaintext.py +152 -0
  140. all2md/parsers/pptx.py +1561 -0
  141. all2md/parsers/rst.py +944 -0
  142. all2md/parsers/rtf.py +532 -0
  143. all2md/parsers/sourcecode.py +441 -0
  144. all2md/parsers/textile.py +210 -0
  145. all2md/parsers/toml.py +595 -0
  146. all2md/parsers/webarchive.py +396 -0
  147. all2md/parsers/xlsx.py +701 -0
  148. all2md/parsers/yaml.py +606 -0
  149. all2md/parsers/zip.py +954 -0
  150. all2md/progress.py +182 -0
  151. all2md/py.typed +0 -0
  152. all2md/renderers/__init__.py +72 -0
  153. all2md/renderers/_split_utils.py +236 -0
  154. all2md/renderers/asciidoc.py +1043 -0
  155. all2md/renderers/ast_json.py +114 -0
  156. all2md/renderers/base.py +332 -0
  157. all2md/renderers/csv.py +378 -0
  158. all2md/renderers/docx.py +1569 -0
  159. all2md/renderers/dokuwiki.py +845 -0
  160. all2md/renderers/epub.py +627 -0
  161. all2md/renderers/html.py +1366 -0
  162. all2md/renderers/ini.py +374 -0
  163. all2md/renderers/ipynb.py +515 -0
  164. all2md/renderers/jinja.py +707 -0
  165. all2md/renderers/json.py +482 -0
  166. all2md/renderers/latex.py +912 -0
  167. all2md/renderers/markdown.py +1665 -0
  168. all2md/renderers/mediawiki.py +797 -0
  169. all2md/renderers/odp.py +1304 -0
  170. all2md/renderers/odt.py +1445 -0
  171. all2md/renderers/org.py +1008 -0
  172. all2md/renderers/pdf.py +1264 -0
  173. all2md/renderers/plaintext.py +730 -0
  174. all2md/renderers/pptx.py +1365 -0
  175. all2md/renderers/rst.py +1032 -0
  176. all2md/renderers/rtf.py +581 -0
  177. all2md/renderers/textile.py +772 -0
  178. all2md/renderers/toml.py +492 -0
  179. all2md/renderers/yaml.py +490 -0
  180. all2md/search/__init__.py +62 -0
  181. all2md/search/bm25.py +147 -0
  182. all2md/search/chunking.py +194 -0
  183. all2md/search/hybrid.py +53 -0
  184. all2md/search/index.py +134 -0
  185. all2md/search/service.py +907 -0
  186. all2md/search/types.py +57 -0
  187. all2md/search/vector.py +243 -0
  188. all2md/transforms/__init__.py +149 -0
  189. all2md/transforms/_builtin_metadata.py +290 -0
  190. all2md/transforms/builtin.py +1421 -0
  191. all2md/transforms/hooks.py +553 -0
  192. all2md/transforms/metadata.py +566 -0
  193. all2md/transforms/options.py +285 -0
  194. all2md/transforms/pipeline.py +1253 -0
  195. all2md/transforms/registry.py +439 -0
  196. all2md/utils/__init__.py +27 -0
  197. all2md/utils/attachments.py +1158 -0
  198. all2md/utils/chart_helpers.py +136 -0
  199. all2md/utils/decorators.py +200 -0
  200. all2md/utils/encoding.py +358 -0
  201. all2md/utils/escape.py +465 -0
  202. all2md/utils/flavors.py +772 -0
  203. all2md/utils/footnotes.py +117 -0
  204. all2md/utils/html_sanitizer.py +808 -0
  205. all2md/utils/html_utils.py +86 -0
  206. all2md/utils/images.py +437 -0
  207. all2md/utils/input_sources.py +629 -0
  208. all2md/utils/inputs.py +528 -0
  209. all2md/utils/io_utils.py +140 -0
  210. all2md/utils/metadata.py +837 -0
  211. all2md/utils/network_security.py +709 -0
  212. all2md/utils/packages.py +66 -0
  213. all2md/utils/parser_helpers.py +593 -0
  214. all2md/utils/robots_txt.py +321 -0
  215. all2md/utils/security.py +1204 -0
  216. all2md/utils/spreadsheet.py +223 -0
  217. all2md/utils/static_site.py +765 -0
  218. all2md/utils/text.py +217 -0
  219. all2md-1.0.1.dist-info/METADATA +960 -0
  220. all2md-1.0.1.dist-info/RECORD +223 -0
  221. all2md-1.0.1.dist-info/WHEEL +4 -0
  222. all2md-1.0.1.dist-info/entry_points.txt +15 -0
  223. all2md-1.0.1.dist-info/licenses/LICENSE +21 -0
all2md/__init__.py ADDED
@@ -0,0 +1,303 @@
1
+ """all2md - A Python document conversion library for bidirectional transformation.
2
+
3
+ all2md provides a comprehensive solution for converting between various file formats
4
+ and Markdown. It supports PDF, Word (DOCX), PowerPoint (PPTX), HTML, email (EML),
5
+ Excel (XLSX), Jupyter Notebooks (IPYNB), EPUB e-books, images, and 200+ text file formats with
6
+ intelligent content extraction and formatting preservation.
7
+
8
+ The library uses a modular architecture where the main `to_markdown()` function
9
+ automatically detects file types and routes to appropriate specialized parsers.
10
+ Each converter module handles specific format requirements while maintaining
11
+ consistent Markdown output with support for tables, images, and complex formatting.
12
+
13
+ Key Features
14
+ ------------
15
+ - Advanced PDF parsing with table detection using PyMuPDF
16
+ - Word document processing with formatting preservation
17
+ - PowerPoint slide-by-slide extraction
18
+ - HTML processing with configurable conversion options
19
+ - Email chain parsing with attachment handling
20
+ - Base64 image embedding support
21
+ - Support for 200+ plaintext file formats
22
+ - AST-based transformation pipeline for document manipulation
23
+ - Plugin system for custom transforms via entry points
24
+
25
+ Supported Formats
26
+ -----------------
27
+ - **Documents**: PDF, DOCX, PPTX, HTML, EML, EPUB
28
+ - **Notebooks**: IPYNB (Jupyter Notebooks)
29
+ - **Spreadsheets**: XLSX, CSV, TSV
30
+ - **Images**: PNG, JPEG, GIF (embedded as base64)
31
+ - **Text**: 200+ formats including code files, configs, markup
32
+
33
+ Requirements
34
+ ------------
35
+ - Python 3.10+
36
+ - Optional dependencies loaded per format (PyMuPDF, python-docx, etc.)
37
+
38
+ Examples
39
+ --------
40
+ Basic usage for file conversion:
41
+
42
+ >>> from all2md import to_markdown
43
+ >>> markdown_content = to_markdown('document.pdf')
44
+ >>> print(markdown_content)
45
+
46
+ Using AST transforms to manipulate documents:
47
+
48
+ >>> from all2md import to_markdown
49
+ >>> from all2md.transforms import RemoveImagesTransform, HeadingOffsetTransform
50
+ >>>
51
+ >>> # Apply transforms during conversion
52
+ >>> markdown = to_markdown(
53
+ ... 'document.pdf',
54
+ ... transforms=[
55
+ ... RemoveImagesTransform(),
56
+ ... HeadingOffsetTransform(offset=1)
57
+ ... ]
58
+ ... )
59
+
60
+ Working with the AST directly:
61
+
62
+ >>> from all2md import to_ast
63
+ >>> from all2md.transforms import render
64
+ >>>
65
+ >>> # Convert to AST
66
+ >>> doc = to_ast('document.pdf')
67
+ >>>
68
+ >>> # Apply transforms and render
69
+ >>> markdown = render(doc, transforms=['remove-images', 'heading-offset'])
70
+
71
+ See Also
72
+ --------
73
+ all2md.transforms : AST transformation system
74
+ all2md.ast : AST node definitions and utilities
75
+
76
+ """
77
+
78
+ # Copyright (c) 2025 Tom Villani, Ph.D.
79
+
80
+ # Check Python version before any imports
81
+ import sys
82
+
83
+ if sys.version_info < (3, 10):
84
+ raise ImportError(
85
+ "all2md requires Python 3.10 or later. "
86
+ f"You are using Python {sys.version_info.major}.{sys.version_info.minor}."
87
+ )
88
+
89
+ __version__ = "1.0.0"
90
+
91
+ from typing import TYPE_CHECKING, Any
92
+
93
+ if TYPE_CHECKING:
94
+ # Import heavy modules for type checking without runtime overhead
95
+ from all2md import ast, parsers, transforms # noqa: F401
96
+ from all2md.ast import Document # noqa: F401 - used in docstrings
97
+
98
+ # Import all option classes for type checking
99
+ from all2md.options.asciidoc import AsciiDocOptions, AsciiDocRendererOptions # noqa: F401
100
+ from all2md.options.chm import ChmOptions # noqa: F401
101
+ from all2md.options.csv import CsvOptions # noqa: F401
102
+ from all2md.options.docx import DocxOptions, DocxRendererOptions # noqa: F401
103
+ from all2md.options.eml import EmlOptions # noqa: F401
104
+ from all2md.options.epub import EpubOptions, EpubRendererOptions # noqa: F401
105
+ from all2md.options.html import HtmlOptions, HtmlRendererOptions # noqa: F401
106
+ from all2md.options.ipynb import IpynbOptions, IpynbRendererOptions # noqa: F401
107
+ from all2md.options.latex import LatexOptions, LatexRendererOptions # noqa: F401
108
+ from all2md.options.markdown import MarkdownParserOptions, MarkdownRendererOptions # noqa: F401
109
+ from all2md.options.mediawiki import MediaWikiOptions # noqa: F401
110
+ from all2md.options.mhtml import MhtmlOptions # noqa: F401
111
+ from all2md.options.odp import OdpOptions # noqa: F401
112
+ from all2md.options.ods import OdsSpreadsheetOptions # noqa: F401
113
+ from all2md.options.odt import OdtOptions # noqa: F401
114
+ from all2md.options.pdf import PdfOptions, PdfRendererOptions # noqa: F401
115
+ from all2md.options.plaintext import PlainTextOptions # noqa: F401
116
+ from all2md.options.pptx import PptxOptions, PptxRendererOptions # noqa: F401
117
+ from all2md.options.rst import RstParserOptions, RstRendererOptions # noqa: F401
118
+ from all2md.options.rtf import RtfOptions # noqa: F401
119
+ from all2md.options.sourcecode import SourceCodeOptions # noqa: F401
120
+ from all2md.options.xlsx import XlsxOptions # noqa: F401
121
+ from all2md.options.zip import ZipOptions # noqa: F401
122
+ from all2md.utils.input_sources import RemoteInputOptions # noqa: F401
123
+
124
+ from all2md.api import (
125
+ convert,
126
+ from_ast,
127
+ from_markdown,
128
+ to_ast,
129
+ to_markdown,
130
+ )
131
+ from all2md.constants import DocumentFormat
132
+
133
+ # Extensions lists moved to constants.py - keep references for backward compatibility
134
+ from all2md.converter_registry import registry
135
+ from all2md.exceptions import All2MdError, DependencyError, FormatError, ParsingError
136
+
137
+ # Keep only base and common option classes that are lightweight and frequently used
138
+ from all2md.options.base import BaseParserOptions, BaseRendererOptions
139
+ from all2md.options.common import LocalFileAccessOptions, NetworkFetchOptions
140
+ from all2md.progress import ProgressCallback, ProgressEvent
141
+
142
+ # Import parsers to trigger registration (must be eager, not lazy)
143
+ from . import parsers # noqa: F401
144
+
145
+ # Lazy loading for heavy modules - only imported when accessed
146
+ # This significantly improves CLI startup time by deferring AST and transforms
147
+ # Note: parsers must be imported eagerly to trigger auto-discovery
148
+ _lazy_modules = {
149
+ "ast": "all2md.ast",
150
+ "transforms": "all2md.transforms",
151
+ }
152
+
153
+ # Lazy loading for option classes - maps class name to (module_path, class_name)
154
+ _lazy_options = {
155
+ "AsciiDocOptions": ("all2md.options.asciidoc", "AsciiDocOptions"),
156
+ "AsciiDocRendererOptions": ("all2md.options.asciidoc", "AsciiDocRendererOptions"),
157
+ "ChmOptions": ("all2md.options.chm", "ChmOptions"),
158
+ "CsvOptions": ("all2md.options.csv", "CsvOptions"),
159
+ "DocxOptions": ("all2md.options.docx", "DocxOptions"),
160
+ "DocxRendererOptions": ("all2md.options.docx", "DocxRendererOptions"),
161
+ "EmlOptions": ("all2md.options.eml", "EmlOptions"),
162
+ "EpubOptions": ("all2md.options.epub", "EpubOptions"),
163
+ "EpubRendererOptions": ("all2md.options.epub", "EpubRendererOptions"),
164
+ "HtmlOptions": ("all2md.options.html", "HtmlOptions"),
165
+ "HtmlRendererOptions": ("all2md.options.html", "HtmlRendererOptions"),
166
+ "IpynbOptions": ("all2md.options.ipynb", "IpynbOptions"),
167
+ "IpynbRendererOptions": ("all2md.options.ipynb", "IpynbRendererOptions"),
168
+ "LatexOptions": ("all2md.options.latex", "LatexOptions"),
169
+ "LatexRendererOptions": ("all2md.options.latex", "LatexRendererOptions"),
170
+ "MarkdownParserOptions": ("all2md.options.markdown", "MarkdownParserOptions"),
171
+ "MarkdownRendererOptions": ("all2md.options.markdown", "MarkdownRendererOptions"),
172
+ "MediaWikiOptions": ("all2md.options.mediawiki", "MediaWikiOptions"),
173
+ "MhtmlOptions": ("all2md.options.mhtml", "MhtmlOptions"),
174
+ "OdpOptions": ("all2md.options.odp", "OdpOptions"),
175
+ "OdsSpreadsheetOptions": ("all2md.options.ods", "OdsSpreadsheetOptions"),
176
+ "OdtOptions": ("all2md.options.odt", "OdtOptions"),
177
+ "PdfOptions": ("all2md.options.pdf", "PdfOptions"),
178
+ "PdfRendererOptions": ("all2md.options.pdf", "PdfRendererOptions"),
179
+ "PlainTextOptions": ("all2md.options.plaintext", "PlainTextOptions"),
180
+ "PptxOptions": ("all2md.options.pptx", "PptxOptions"),
181
+ "PptxRendererOptions": ("all2md.options.pptx", "PptxRendererOptions"),
182
+ "RstParserOptions": ("all2md.options.rst", "RstParserOptions"),
183
+ "RstRendererOptions": ("all2md.options.rst", "RstRendererOptions"),
184
+ "RtfOptions": ("all2md.options.rtf", "RtfOptions"),
185
+ "SourceCodeOptions": ("all2md.options.sourcecode", "SourceCodeOptions"),
186
+ "XlsxOptions": ("all2md.options.xlsx", "XlsxOptions"),
187
+ "ZipOptions": ("all2md.options.zip", "ZipOptions"),
188
+ "RemoteInputOptions": ("all2md.utils.input_sources", "RemoteInputOptions"),
189
+ }
190
+
191
+ # Options handling helpers
192
+
193
+
194
+ __all__ = [
195
+ "__version__",
196
+ "to_markdown",
197
+ "to_ast",
198
+ "from_ast",
199
+ "from_markdown",
200
+ "convert",
201
+ # Registry system
202
+ "registry",
203
+ # Type definitions
204
+ "DocumentFormat",
205
+ # Progress system
206
+ "ProgressCallback",
207
+ "ProgressEvent",
208
+ # Re-exported classes and exceptions for public API
209
+ "BaseRendererOptions",
210
+ "BaseParserOptions",
211
+ "NetworkFetchOptions",
212
+ "LocalFileAccessOptions",
213
+ "AsciiDocRendererOptions",
214
+ "AsciiDocOptions",
215
+ "ChmOptions",
216
+ "CsvOptions",
217
+ "DocxOptions",
218
+ "DocxRendererOptions",
219
+ "EmlOptions",
220
+ "EpubOptions",
221
+ "EpubRendererOptions",
222
+ "HtmlRendererOptions",
223
+ "HtmlOptions",
224
+ "IpynbOptions",
225
+ "IpynbRendererOptions",
226
+ "LatexRendererOptions",
227
+ "LatexOptions",
228
+ "MarkdownRendererOptions",
229
+ "MarkdownParserOptions",
230
+ "MediaWikiOptions",
231
+ "MhtmlOptions",
232
+ "OdpOptions",
233
+ "OdsSpreadsheetOptions",
234
+ "OdtOptions",
235
+ "PdfOptions",
236
+ "PdfRendererOptions",
237
+ "PptxOptions",
238
+ "PptxRendererOptions",
239
+ "RstParserOptions",
240
+ "RstRendererOptions",
241
+ "RtfOptions",
242
+ "SourceCodeOptions",
243
+ "PlainTextOptions",
244
+ "XlsxOptions",
245
+ "ZipOptions",
246
+ "RemoteInputOptions",
247
+ # Exceptions
248
+ "DependencyError",
249
+ "All2MdError",
250
+ "FormatError",
251
+ "ParsingError",
252
+ # AST module (for advanced users)
253
+ "ast",
254
+ # Transforms module (for AST transformations)
255
+ "transforms",
256
+ ]
257
+
258
+
259
+ def __getattr__(name: str) -> Any:
260
+ """Lazy load heavy modules and option classes on first access.
261
+
262
+ This function is called when an attribute is not found in the module namespace.
263
+ It allows us to defer importing heavy modules (ast, parsers, transforms) and
264
+ option classes until they are actually accessed, significantly improving CLI
265
+ startup time.
266
+
267
+ Parameters
268
+ ----------
269
+ name : str
270
+ The name of the attribute being accessed
271
+
272
+ Returns
273
+ -------
274
+ Any
275
+ The requested module, class, or attribute
276
+
277
+ Raises
278
+ ------
279
+ AttributeError
280
+ If the attribute is not found and is not a lazy-loadable item
281
+
282
+ """
283
+ import importlib
284
+
285
+ # Check if it's a lazy-loaded module
286
+ if name in _lazy_modules:
287
+ # nosemgrep: python.lang.security.audit.non-literal-import.non-literal-import
288
+ module = importlib.import_module(_lazy_modules[name])
289
+ # Cache the module in this module's namespace for faster future access
290
+ globals()[name] = module
291
+ return module
292
+
293
+ # Check if it's a lazy-loaded option class
294
+ if name in _lazy_options:
295
+ module_path, class_name = _lazy_options[name]
296
+ # nosemgrep: python.lang.security.audit.non-literal-import.non-literal-import
297
+ module = importlib.import_module(module_path)
298
+ cls = getattr(module, class_name)
299
+ # Cache the class in this module's namespace for faster future access
300
+ globals()[name] = cls
301
+ return cls
302
+
303
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
all2md/__main__.py ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for running all2md as a module.
3
+
4
+ This allows the package to be executed as:
5
+ python -m all2md [arguments]
6
+ """
7
+
8
+ import sys
9
+
10
+ from .cli import main
11
+
12
+ if __name__ == "__main__":
13
+ sys.exit(main())
@@ -0,0 +1,199 @@
1
+ [
2
+ ".adoc",
3
+ ".asciidoc",
4
+ ".asm",
5
+ ".asp",
6
+ ".aspx",
7
+ ".atom",
8
+ ".awk",
9
+ ".babelrc",
10
+ ".bash",
11
+ ".bat",
12
+ ".bazel",
13
+ ".bib",
14
+ ".bzl",
15
+ ".c",
16
+ ".cfg",
17
+ ".cjs",
18
+ ".clj",
19
+ ".cmake",
20
+ ".cmd",
21
+ ".coffee",
22
+ ".conf",
23
+ ".config",
24
+ ".cpp",
25
+ ".cs",
26
+ ".csh",
27
+ ".cshtml",
28
+ ".cson",
29
+ ".css",
30
+ ".csv",
31
+ ".cypher",
32
+ ".d",
33
+ ".dart",
34
+ ".desktop",
35
+ ".diff",
36
+ ".dockerfile",
37
+ ".dtd",
38
+ ".editorconfig",
39
+ ".ejs",
40
+ ".el",
41
+ ".elm",
42
+ ".env",
43
+ ".erb",
44
+ ".erl",
45
+ ".eslintignore",
46
+ ".eslintrc",
47
+ ".ex",
48
+ ".exs",
49
+ ".f",
50
+ ".f90",
51
+ ".f95",
52
+ ".fish",
53
+ ".for",
54
+ ".fs",
55
+ ".gemspec",
56
+ ".geojson",
57
+ ".gitattributes",
58
+ ".gitignore",
59
+ ".gn",
60
+ ".go",
61
+ ".gql",
62
+ ".gradle",
63
+ ".graphql",
64
+ ".graphqlrc",
65
+ ".groovy",
66
+ ".gyp",
67
+ ".h",
68
+ ".haml",
69
+ ".hbs",
70
+ ".hcl",
71
+ ".hjson",
72
+ ".hpp",
73
+ ".hrl",
74
+ ".hs",
75
+ ".htaccess",
76
+ ".htm",
77
+ ".html",
78
+ ".htpasswd",
79
+ ".ics",
80
+ ".iml",
81
+ ".inf",
82
+ ".ini",
83
+ ".ipynb",
84
+ ".jade",
85
+ ".java",
86
+ ".jbuilder",
87
+ ".jenkinsfile",
88
+ ".jl",
89
+ ".js",
90
+ ".json5",
91
+ ".jsonld",
92
+ ".jsx",
93
+ ".ksh",
94
+ ".kt",
95
+ ".kts",
96
+ ".less",
97
+ ".liquid",
98
+ ".lisp",
99
+ ".log",
100
+ ".lua",
101
+ ".m",
102
+ ".mak",
103
+ ".make",
104
+ ".markdown",
105
+ ".md",
106
+ ".mdown",
107
+ ".mdwn",
108
+ ".mdx",
109
+ ".mediawiki",
110
+ ".mjs",
111
+ ".mkd",
112
+ ".mkdn",
113
+ ".mm",
114
+ ".mustache",
115
+ ".nfo",
116
+ ".nginx",
117
+ ".nim",
118
+ ".npmrc",
119
+ ".nsi",
120
+ ".nt",
121
+ ".opml",
122
+ ".org",
123
+ ".p",
124
+ ".pas",
125
+ ".patch",
126
+ ".php",
127
+ ".pl",
128
+ ".plist",
129
+ ".pod",
130
+ ".podspec",
131
+ ".pp",
132
+ ".prettierignore",
133
+ ".prisma",
134
+ ".pro",
135
+ ".properties",
136
+ ".proto",
137
+ ".ps1",
138
+ ".pug",
139
+ ".py",
140
+ ".pyx",
141
+ ".r",
142
+ ".rake",
143
+ ".rb",
144
+ ".rdoc",
145
+ ".reg",
146
+ ".rhtml",
147
+ ".robots",
148
+ ".rs",
149
+ ".rss",
150
+ ".rst",
151
+ ".sas",
152
+ ".sass",
153
+ ".sbt",
154
+ ".scala",
155
+ ".scm",
156
+ ".scss",
157
+ ".sed",
158
+ ".sgml",
159
+ ".sh",
160
+ ".shtml",
161
+ ".sitemap",
162
+ ".sql",
163
+ ".styl",
164
+ ".stylelintrc",
165
+ ".svelte",
166
+ ".svg",
167
+ ".swift",
168
+ ".tcl",
169
+ ".tex",
170
+ ".textile",
171
+ ".tf",
172
+ ".thor",
173
+ ".toml",
174
+ ".tpl",
175
+ ".ts",
176
+ ".tsv",
177
+ ".tsx",
178
+ ".ttl",
179
+ ".twig",
180
+ ".txt",
181
+ ".v",
182
+ ".vb",
183
+ ".vbhtml",
184
+ ".vcf",
185
+ ".vhd",
186
+ ".vim",
187
+ ".vue",
188
+ ".webmanifest",
189
+ ".wiki",
190
+ ".wsdl",
191
+ ".wsgi",
192
+ ".xaml",
193
+ ".xhtml",
194
+ ".xml",
195
+ ".xsd",
196
+ ".yaml",
197
+ ".yml",
198
+ ".zsh"
199
+ ]