Skip to content

Commit 869087b

Browse files
authored
docs: Refactor with more_autodoc.typehints and built-in type links (#42)
1 parent d82f4e4 commit 869087b

File tree

5 files changed

+99
-39
lines changed

5 files changed

+99
-39
lines changed

docs/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@
4040
"sphinxcontrib_trio",
4141
"enum_tools.autoenum",
4242
"sphinxext.opengraph",
43+
"sphinx_toolbox.more_autodoc.typehints",
4344
]
4445

46+
intersphinx_mapping = {
47+
"py": ("https://docs.python.org/3", None),
48+
}
49+
4550
# Add any paths that contain templates here, relative to this directory.
4651
templates_path = ["_templates"]
4752

docs/source/generate_style_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def generate_style_list():
3636
last_col_heading=False,
3737
style=styles[style],
3838
)
39-
style_heading = f"`{style}`\n" + "~" * len(f"`{style}`")
39+
style_heading = f".. _PresetStyle.{style}:\n\n`{style}`\n" + "~" * len(f"`{style}`")
4040
output_example = indent_all_lines(full + "\n\n" + body_only)
4141
style_list += f"{style_heading}\n\n.. code-block:: none\n\n{output_example}\n\n"
4242
# put it all together

docs/source/styles.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Preset styles
55

66
.. contents::
77

8+
.. _PresetStyle.ascii:
9+
810
`ascii`
911
~~~~~~~
1012

@@ -26,6 +28,8 @@ Preset styles
2628
| 2 | 30 40 35 30 |
2729
+---+-------------------+
2830
31+
.. _PresetStyle.ascii_borderless:
32+
2933
`ascii_borderless`
3034
~~~~~~~~~~~~~~~~~~
3135

@@ -41,6 +45,8 @@ Preset styles
4145
1 | 30 40 35 30
4246
2 | 30 40 35 30
4347
48+
.. _PresetStyle.ascii_box:
49+
4450
`ascii_box`
4551
~~~~~~~~~~~
4652

@@ -62,6 +68,8 @@ Preset styles
6268
| 2 | 30 | 40 | 35 | 30 |
6369
+---+----+----+----+----+
6470
71+
.. _PresetStyle.ascii_compact:
72+
6573
`ascii_compact`
6674
~~~~~~~~~~~~~~~
6775

@@ -81,6 +89,8 @@ Preset styles
8189
| 2 | 30 40 35 30 |
8290
+---+-------------------+
8391
92+
.. _PresetStyle.ascii_double:
93+
8494
`ascii_double`
8595
~~~~~~~~~~~~~~
8696

@@ -102,6 +112,8 @@ Preset styles
102112
| 2 | 30 40 35 30 |
103113
+---+-------------------+
104114
115+
.. _PresetStyle.ascii_minimalist:
116+
105117
`ascii_minimalist`
106118
~~~~~~~~~~~~~~~~~~
107119

@@ -123,6 +135,8 @@ Preset styles
123135
2 | 30 40 35 30
124136
-----------------------
125137
138+
.. _PresetStyle.ascii_simple:
139+
126140
`ascii_simple`
127141
~~~~~~~~~~~~~~
128142

@@ -142,6 +156,8 @@ Preset styles
142156
2 | 30 40 35 30
143157
=== ==== ==== ==== ====
144158
159+
.. _PresetStyle.borderless:
160+
145161
`borderless`
146162
~~~~~~~~~~~~
147163

@@ -157,6 +173,8 @@ Preset styles
157173
1 ┃ 30 40 35 30
158174
2 ┃ 30 40 35 30
159175
176+
.. _PresetStyle.double:
177+
160178
`double`
161179
~~~~~~~~
162180

@@ -178,6 +196,8 @@ Preset styles
178196
║ 2 ║ 30 40 35 30 ║
179197
╚═══╩═══════════════════╝
180198
199+
.. _PresetStyle.double_box:
200+
181201
`double_box`
182202
~~~~~~~~~~~~
183203

@@ -199,6 +219,8 @@ Preset styles
199219
║ 2 ║ 30 ║ 40 ║ 35 ║ 30 ║
200220
╚═══╩════╩════╩════╩════╝
201221
222+
.. _PresetStyle.double_compact:
223+
202224
`double_compact`
203225
~~~~~~~~~~~~~~~~
204226

@@ -218,6 +240,8 @@ Preset styles
218240
║ 2 ║ 30 40 35 30 ║
219241
╚═══╩═══════════════════╝
220242
243+
.. _PresetStyle.double_thin_compact:
244+
221245
`double_thin_compact`
222246
~~~~~~~~~~~~~~~~~~~~~
223247

@@ -237,6 +261,8 @@ Preset styles
237261
║ 2 ║ 30 40 35 30 ║
238262
╚═══╩═══════════════════╝
239263
264+
.. _PresetStyle.markdown:
265+
240266
`markdown`
241267
~~~~~~~~~~
242268

@@ -252,6 +278,8 @@ Preset styles
252278
| 1 | 30 | 40 | 35 | 30 |
253279
| 2 | 30 | 40 | 35 | 30 |
254280
281+
.. _PresetStyle.minimalist:
282+
255283
`minimalist`
256284
~~~~~~~~~~~~
257285

@@ -273,6 +301,8 @@ Preset styles
273301
2 │ 30 40 35 30
274302
───────────────────────
275303
304+
.. _PresetStyle.simple:
305+
276306
`simple`
277307
~~~~~~~~
278308

@@ -292,6 +322,8 @@ Preset styles
292322
2 ║ 30 40 35 30
293323
═══ ════ ════ ════ ════
294324
325+
.. _PresetStyle.thick:
326+
295327
`thick`
296328
~~~~~~~
297329

@@ -313,6 +345,8 @@ Preset styles
313345
┃ 2 ┃ 30 40 35 30 ┃
314346
┗━━━┻━━━━━━━━━━━━━━━━━━━┛
315347
348+
.. _PresetStyle.thick_box:
349+
316350
`thick_box`
317351
~~~~~~~~~~~
318352

@@ -334,6 +368,8 @@ Preset styles
334368
┃ 2 ┃ 30 ┃ 40 ┃ 35 ┃ 30 ┃
335369
┗━━━┻━━━━┻━━━━┻━━━━┻━━━━┛
336370
371+
.. _PresetStyle.thick_compact:
372+
337373
`thick_compact`
338374
~~~~~~~~~~~~~~~
339375

@@ -353,6 +389,8 @@ Preset styles
353389
┃ 2 ┃ 30 40 35 30 ┃
354390
┗━━━┻━━━━━━━━━━━━━━━━━━━┛
355391
392+
.. _PresetStyle.thin:
393+
356394
`thin`
357395
~~~~~~
358396

@@ -374,6 +412,8 @@ Preset styles
374412
│ 2 │ 30 40 35 30 │
375413
└───┴───────────────────┘
376414
415+
.. _PresetStyle.thin_box:
416+
377417
`thin_box`
378418
~~~~~~~~~~
379419

@@ -395,6 +435,8 @@ Preset styles
395435
│ 2 │ 30 │ 40 │ 35 │ 30 │
396436
└───┴────┴────┴────┴────┘
397437
438+
.. _PresetStyle.thin_compact:
439+
398440
`thin_compact`
399441
~~~~~~~~~~~~~~
400442

@@ -414,6 +456,8 @@ Preset styles
414456
│ 2 │ 30 40 35 30 │
415457
└───┴───────────────────┘
416458
459+
.. _PresetStyle.thin_compact_rounded:
460+
417461
`thin_compact_rounded`
418462
~~~~~~~~~~~~~~~~~~~~~~
419463

@@ -433,6 +477,8 @@ Preset styles
433477
│ 2 │ 30 40 35 30 │
434478
╰───┴───────────────────╯
435479
480+
.. _PresetStyle.thin_double:
481+
436482
`thin_double`
437483
~~~~~~~~~~~~~
438484

@@ -454,6 +500,8 @@ Preset styles
454500
│ 2 │ 30 40 35 30 │
455501
└───┴───────────────────┘
456502
503+
.. _PresetStyle.thin_double_rounded:
504+
457505
`thin_double_rounded`
458506
~~~~~~~~~~~~~~~~~~~~~
459507

@@ -475,6 +523,8 @@ Preset styles
475523
│ 2 │ 30 40 35 30 │
476524
╰───┴───────────────────╯
477525
526+
.. _PresetStyle.thin_rounded:
527+
478528
`thin_rounded`
479529
~~~~~~~~~~~~~~
480530

@@ -496,6 +546,8 @@ Preset styles
496546
│ 2 │ 30 40 35 30 │
497547
╰───┴───────────────────╯
498548
549+
.. _PresetStyle.thin_thick:
550+
499551
`thin_thick`
500552
~~~~~~~~~~~~
501553

@@ -517,6 +569,8 @@ Preset styles
517569
│ 2 │ 30 40 35 30 │
518570
└───┴───────────────────┘
519571
572+
.. _PresetStyle.thin_thick_rounded:
573+
520574
`thin_thick_rounded`
521575
~~~~~~~~~~~~~~~~~~~~
522576

table2ascii/table_style.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def from_string(cls, string: str) -> "TableStyle":
6565
Create a TableStyle from a string
6666
6767
Args:
68-
string (:class:`str`): The string to create the TableStyle from
68+
string: The string to create the TableStyle from
6969
7070
Returns:
71-
:class:`TableStyle`: A TableStyle object
71+
A TableStyle object
7272
7373
Example::
7474

0 commit comments

Comments
 (0)