1
1
<!-- markdownlint-disable -->
2
2
3
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main /src/lazydocs/generation.py#L0" ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
3
+ <a href =" .. /src/lazydocs/generation.py#L0" ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
4
4
5
5
# <kbd >module</kbd > ` lazydocs.generation `
6
- Main module for markdown generation.
6
+ Main module for markdown generation.
7
+
8
+
9
+ ## Table of Contents
10
+ - [ ` MarkdownGenerator ` ] ( ./lazydocs.generation.md#class-markdowngenerator )
11
+ - [`__init__`](./lazydocs.generation.md#constructor-__init__)
12
+ - [`class2md`](./lazydocs.generation.md#method-class2md)
13
+ - [`func2md`](./lazydocs.generation.md#method-func2md)
14
+ - [`import2md`](./lazydocs.generation.md#method-import2md)
15
+ - [`module2md`](./lazydocs.generation.md#method-module2md)
16
+ - [`overview2md`](./lazydocs.generation.md#method-overview2md)
17
+ - [`toc2md`](./lazydocs.generation.md#method-toc2md)
18
+ - [ ` generate_docs ` ] ( ./lazydocs.generation.md#function-generate_docs )
19
+ - [ ` to_md_file ` ] ( ./lazydocs.generation.md#function-to_md_file )
20
+
7
21
8
22
9
23
---
10
24
11
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L197 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
25
+ <a href =" ../ src/lazydocs/generation.py#L223 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
12
26
13
27
## <kbd >function</kbd > ` to_md_file `
14
28
@@ -18,26 +32,28 @@ to_md_file(
18
32
filename: str ,
19
33
out_path: str = ' .' ,
20
34
watermark: bool = True ,
21
- disable_markdownlint: bool = True
35
+ disable_markdownlint: bool = True ,
36
+ is_mdx: bool = False
22
37
) → None
23
38
```
24
39
25
- Creates an API docs file from a provided text.
26
-
40
+ Creates an API docs file from a provided text.
27
41
28
42
29
43
** Args:**
30
-
31
- - <b >` markdown_str ` </b > (str): Markdown string with line breaks to write to file.
32
- - <b >` filename ` </b > (str): Filename without the .md
33
- - <b >` watermark ` </b > (bool): If ` True ` , add a watermark with a timestamp to bottom of the markdown files.
34
- - <b >` disable_markdownlint ` </b > (bool): If ` True ` , an inline tag is added to disable markdownlint for this file.
35
- - <b >` out_path ` </b > (str): The output directory
44
+
45
+ - <b >` markdown_str ` </b > (str): Markdown string with line breaks to write to file.
46
+ - <b >` filename ` </b > (str): Filename without the .md
47
+ - <b >` out_path ` </b > (str): The output directory.
48
+ - <b >` watermark ` </b > (bool): If ` True ` , add a watermark with a timestamp to bottom of the markdown files.
49
+ - <b >` disable_markdownlint ` </b > (bool): If ` True ` , an inline tag is added to disable markdownlint for this file.
50
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
51
+
36
52
37
53
38
54
---
39
55
40
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L889 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
56
+ <a href =" ../ src/lazydocs/generation.py#L1158 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
41
57
42
58
## <kbd >function</kbd > ` generate_docs `
43
59
@@ -49,173 +65,225 @@ generate_docs(
49
65
src_base_url: Optional[str ] = None ,
50
66
remove_package_prefix: bool = False ,
51
67
ignored_modules: Optional[List[str ]] = None ,
68
+ output_format: Optional[str ] = None ,
52
69
overview_file: Optional[str ] = None ,
53
70
watermark: bool = True ,
54
- validate: bool = False
71
+ validate: bool = False ,
72
+ private_modules: bool = False ,
73
+ include_toc: bool = False ,
74
+ url_line_prefix: Optional[str ] = None
55
75
) → None
56
76
```
57
77
58
- Generates markdown documentation for provided paths based on Google-style docstrings.
59
-
78
+ Generates markdown documentation for provided paths based on Google-style docstrings.
60
79
61
80
62
81
** Args:**
63
-
64
- - <b >` paths ` </b >: Selected paths or import name for markdown generation.
65
- - <b >` output_path ` </b >: The output path for the creation of the markdown files. Set this to ` stdout ` to print all markdown to stdout.
66
- - <b >` src_root_path ` </b >: The root folder name containing all the sources. Fallback to git repo root.
67
- - <b >` src_base_url ` </b >: The base url of the github link. Should include branch name. All source links are generated with this prefix.
68
- - <b >` remove_package_prefix ` </b >: If ` True ` , the package prefix will be removed from all functions and methods.
69
- - <b >` ignored_modules ` </b >: A list of modules that should be ignored.
70
- - <b >` overview_file ` </b >: Filename of overview file. If not provided, no overview file will be generated.
71
- - <b >` watermark ` </b >: If ` True ` , add a watermark with a timestamp to bottom of the markdown files.
72
- - <b >` validate ` </b >: If ` True ` , validate the docstrings via pydocstyle. Requires pydocstyle to be installed.
82
+
83
+ - <b >` paths ` </b >: Selected paths or import name for markdown generation.
84
+ - <b >` output_path ` </b >: The output path for the creation of the markdown files. Set this to ` stdout ` to print all markdown to stdout.
85
+ - <b >` src_root_path ` </b >: The root folder name containing all the sources. Fallback to git repo root.
86
+ - <b >` src_base_url ` </b >: The base url of the github link. Should include branch name. All source links are generated with this prefix.
87
+ - <b >` remove_package_prefix ` </b >: If ` True ` , the package prefix will be removed from all functions and methods.
88
+ - <b >` ignored_modules ` </b >: A list of modules that should be ignored.
89
+ - <b >` output_format ` </b >: Markdown file extension and format.
90
+ - <b >` overview_file ` </b >: Filename of overview file. If not provided, no overview file will be generated.
91
+ - <b >` watermark ` </b >: If ` True ` , add a watermark with a timestamp to bottom of the markdown files.
92
+ - <b >` validate ` </b >: If ` True ` , validate the docstrings via pydocstyle. Requires pydocstyle to be installed.
93
+ - <b >` private_modules ` </b >: If ` True ` , includes modules with ` _ ` prefix.
94
+ - <b >` url_line_prefix: Line prefix for git repository line url anchors. Default ` </b >: None - github "L".
95
+
73
96
74
97
75
98
---
76
99
77
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L454 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
100
+ <a href =" ../ src/lazydocs/generation.py#L627 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
78
101
79
102
## <kbd >class</kbd > ` MarkdownGenerator `
80
- Markdown generator class.
103
+ Markdown generator class.
81
104
82
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/src/lazydocs/generation.py#L457 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
83
105
84
- ### <kbd >method</kbd > ` __init__ `
106
+ <a href =" ../src/lazydocs/generation.py#L630 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
107
+
108
+ ### <kbd >constructor</kbd > ` __init__ `
85
109
86
110
``` python
87
- __init__ (
111
+ MarkdownGenerator (
88
112
src_root_path: Optional[str ] = None ,
89
113
src_base_url: Optional[str ] = None ,
90
- remove_package_prefix: bool = False
114
+ remove_package_prefix: bool = False ,
115
+ url_line_prefix: Optional[str ] = None
91
116
)
92
117
```
93
118
94
- Initializes the markdown API generator.
95
-
119
+ Initializes the markdown API generator.
96
120
97
121
98
122
** Args:**
99
-
100
- - <b >` src_root_path ` </b >: The root folder name containing all the sources.
101
- - <b >` src_base_url ` </b >: The base github link. Should include branch name. All source links are generated with this prefix.
102
- - <b >` remove_package_prefix ` </b >: If ` True ` , the package prefix will be removed from all functions and methods.
123
+
124
+ - <b >` src_root_path ` </b >: The root folder name containing all the sources.
125
+ - <b >` src_base_url ` </b >: The base github link. Should include branch name.
126
+ All source links are generated with this prefix.
127
+ - <b >` remove_package_prefix ` </b >: If ` True ` , the package prefix will be removed from all functions and methods.
128
+ - <b >` url_line_prefix: Line prefix for git repository line url anchors. Default ` </b >: None - github "L".
129
+
103
130
104
131
105
132
106
133
107
134
---
108
135
109
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L609 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
136
+ <a href =" ../ src/lazydocs/generation.py#L795 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
110
137
111
138
### <kbd >method</kbd > ` class2md `
112
139
113
140
``` python
114
- class2md(cls : Any, depth: int = 2 ) → str
141
+ class2md(cls : Any, depth: int = 2 , is_mdx: bool = False ) → str
115
142
```
116
143
117
- Takes a class and creates markdown text to document its methods and variables.
118
-
144
+ Takes a class and creates markdown text to document its methods and variables.
119
145
120
146
121
147
** Args:**
122
-
123
- - <b >` cls ` </b > (class): Selected class for markdown generation.
124
- - <b >` depth ` </b > (int, optional): Number of # to append to function name. Defaults to 2.
125
148
149
+ - <b >` cls ` </b > (class): Selected class for markdown generation.
150
+ - <b >` depth ` </b > (int, optional): Number of # to append to function name. Defaults to 2.
151
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
126
152
127
153
128
154
** Returns:**
129
-
130
- - <b >` str ` </b >: Markdown documentation for selected class.
155
+
156
+ - <b >` str ` </b >: Markdown documentation for selected class.
157
+
131
158
132
159
---
133
160
134
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L524 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
161
+ <a href =" ../ src/lazydocs/generation.py#L706 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
135
162
136
163
### <kbd >method</kbd > ` func2md `
137
164
138
165
``` python
139
- func2md(func: Callable, clsname: str = ' ' , depth: int = 3 ) → str
166
+ func2md(
167
+ func: Callable,
168
+ clsname: str = ' ' ,
169
+ depth: int = 3 ,
170
+ is_mdx: bool = False
171
+ ) → str
140
172
```
141
173
142
- Takes a function (or method) and generates markdown docs.
143
-
174
+ Takes a function (or method) and generates markdown docs.
144
175
145
176
146
177
** Args:**
147
-
148
- - <b >` func ` </b > (Callable): Selected function (or method) for markdown generation.
149
- - <b >` clsname ` </b > (str, optional): Class name to prepend to funcname. Defaults to "".
150
- - <b >` depth ` </b > (int, optional): Number of # to append to class name. Defaults to 3.
151
178
179
+ - <b >` func ` </b > (Callable): Selected function (or method) for markdown generation.
180
+ - <b >` clsname ` </b > (str, optional): Class name to prepend to funcname. Defaults to "".
181
+ - <b >` depth ` </b > (int, optional): Number of # to append to class name. Defaults to 3.
182
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
152
183
153
184
154
185
** Returns:**
155
-
156
- - <b >` str ` </b >: Markdown documentation for selected function.
186
+
187
+ - <b >` str ` </b >: Markdown documentation for selected function.
188
+
157
189
158
190
---
159
191
160
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L815 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
192
+ <a href =" ../ src/lazydocs/generation.py#L1046 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
161
193
162
194
### <kbd >method</kbd > ` import2md `
163
195
164
196
``` python
165
- import2md(obj: Any, depth: int = 1 ) → str
197
+ import2md(
198
+ obj: Any,
199
+ depth: int = 1 ,
200
+ is_mdx: bool = False ,
201
+ include_toc: bool = False
202
+ ) → str
166
203
```
167
204
168
- Generates markdown documentation for a selected object/import.
169
-
205
+ Generates markdown documentation for a selected object/import.
170
206
171
207
172
208
** Args:**
173
-
174
- - <b >` obj ` </b > (Any): Selcted object for markdown docs generation.
175
- - <b >` depth ` </b > (int, optional): Number of # to append before heading. Defaults to 1.
176
209
210
+ - <b >` obj ` </b > (Any): Selcted object for markdown docs generation.
211
+ - <b >` depth ` </b > (int, optional): Number of # to append before heading. Defaults to 1.
212
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
213
+ - <b >` include_toc ` </b > (bool, Optional): Include table of contents for module file. Defaults to False.
177
214
178
215
179
216
** Returns:**
180
-
181
- - <b >` str ` </b >: Markdown documentation of selected object.
217
+
218
+ - <b >` str ` </b >: Markdown documentation of selected object.
219
+
182
220
183
221
---
184
222
185
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L720 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
223
+ <a href =" ../ src/lazydocs/generation.py#L943 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
186
224
187
225
### <kbd >method</kbd > ` module2md `
188
226
189
227
``` python
190
- module2md(module: module, depth: int = 1 ) → str
228
+ module2md(
229
+ module: module,
230
+ depth: int = 1 ,
231
+ is_mdx: bool = False ,
232
+ include_toc: bool = False
233
+ ) → str
191
234
```
192
235
193
- Takes an imported module object and create a Markdown string containing functions and classes.
194
-
236
+ Takes an imported module object and create a Markdown string containing functions and classes.
195
237
196
238
197
239
** Args:**
198
-
199
- - <b >` module ` </b > (types.ModuleType): Selected module for markdown generation.
200
- - <b >` depth ` </b > (int, optional): Number of # to append before module heading. Defaults to 1.
201
240
241
+ - <b >` module ` </b > (types.ModuleType): Selected module for markdown generation.
242
+ - <b >` depth ` </b > (int, optional): Number of # to append before module heading. Defaults to 1.
243
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
244
+ - <b >` include_toc ` </b > (bool, optional): Include table of contents in module file. Defaults to False.
202
245
203
246
204
247
** Returns:**
205
-
206
- - <b >` str ` </b >: Markdown documentation for selected module.
248
+
249
+ - <b >` str ` </b >: Markdown documentation for selected module.
250
+
207
251
208
252
---
209
253
210
- <a href =" https://github.com/ml-tooling/lazydocs/blob/main/ src/lazydocs/generation.py#L835 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
254
+ <a href =" ../ src/lazydocs/generation.py#L1068 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
211
255
212
256
### <kbd >method</kbd > ` overview2md `
213
257
214
258
``` python
215
- overview2md() → str
259
+ overview2md(is_mdx: bool = False ) → str
260
+ ```
261
+
262
+ Generates a documentation overview file based on the generated docs.
263
+
264
+
265
+ ** Args:**
266
+
267
+ - <b >` is_mdx ` </b > (bool, optional): JSX support. Default to False.
268
+
269
+
270
+ ** Returns:**
271
+
272
+ - <b >` str ` </b >: Markdown documentation of overview file.
273
+
274
+
275
+ ---
276
+
277
+ <a href =" ../src/lazydocs/generation.py#L1137 " ><img align =" right " style =" float :right ;" src =" https://img.shields.io/badge/-source-cccccc?style=flat-square " /></a >
278
+
279
+ ### <kbd >method</kbd > ` toc2md `
280
+
281
+ ``` python
282
+ toc2md(module: module = None , is_mdx: bool = False ) → str
216
283
```
217
284
218
- Generates a documentation overview file based on the generated docs.
285
+ Generates table of contents for imported object.
286
+
219
287
220
288
221
289
0 commit comments