Skip to content

Commit de89b12

Browse files
authored
Docs fixes (#84)
* Set column width for CLI help * Update mkdocs and mkdocstrings configurations * Fix config docstrings * Fix reprexes dataclass docstrings * Bump lockfile --------- Co-authored-by: Jay Qi <jayqi@users.noreply.github.com>
1 parent 85f0926 commit de89b12

File tree

6 files changed

+43
-57
lines changed

6 files changed

+43
-57
lines changed

docs/docs/css/extra.css

-33
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,3 @@ th.no-wrap,
1212
td.no-wrap {
1313
white-space: nowrap;
1414
}
15-
16-
17-
/* mkdocstrings custom style */
18-
19-
.doc.doc-heading {
20-
padding-left: 1ch;
21-
padding-bottom: 5px;
22-
background-color: #F8F8F8;
23-
}
24-
25-
div.doc-contents:not(.first) {
26-
padding-left: 2ch;
27-
}
28-
29-
/* Class name headings */
30-
h3.doc.doc-heading>code {
31-
font-weight: bold;
32-
}
33-
34-
/* Class attribute and method headings */
35-
h5.doc.doc-heading {
36-
font-size: 1em;
37-
text-transform: none;
38-
}
39-
40-
/* Bold function, method, and attribute names */
41-
.doc.doc-heading span {
42-
font-weight: bold;
43-
}
44-
45-
.doc.doc-heading span~span {
46-
font-weight: normal;
47-
}

docs/mkdocs.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,29 @@ theme:
3232
logo: images/reprexlite.svg
3333
favicon: images/reprexlite_white_blue.svg
3434
palette:
35-
# Palette toggle for dark mode
36-
- scheme: slate
35+
# Palette toggle for automatic mode
36+
- media: "(prefers-color-scheme)"
3737
primary: indigo
3838
accent: blue
3939
toggle:
40-
icon: material/brightness-4
40+
icon: material/brightness-auto
4141
name: Switch to light mode
4242
# Palette toggle for light mode
43-
- scheme: default
43+
- media: "(prefers-color-scheme: light)"
4444
primary: indigo
4545
accent: blue
46+
scheme: default
4647
toggle:
4748
icon: material/brightness-7
4849
name: Switch to dark mode
50+
# Palette toggle for dark mode
51+
- media: "(prefers-color-scheme: dark)"
52+
primary: indigo
53+
accent: blue
54+
scheme: slate
55+
toggle:
56+
icon: material/brightness-4
57+
name: Switch to system preference
4958
custom_dir: overrides/
5059

5160
extra_css:
@@ -75,20 +84,24 @@ plugins:
7584
python:
7685
paths: [../reprexlite]
7786
options:
87+
# General
88+
docstring_style: google
7889
# Headings options
7990
heading_level: 2
8091
show_root_toc_entry: false
8192
show_root_full_path: false
8293
show_root_heading: false
8394
show_category_heading: true
8495
# Members options
85-
filters: ["!^_(?!_init__)"]
86-
group_by_category: true
87-
inherited_members: true
96+
filters: ["!^_", "^__init__$"]
8897
# Docstrings options
8998
show_if_no_docstring: false
99+
merge_init_into_class: true
90100
# Signatures/annotation options
101+
annotations_path: brief
102+
separate_signature: true
91103
show_signature_annotations: true
104+
unwrap_annotated: true
92105
# Additional options
93106
show_source: true
94107
- mike:

justfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ _docs-preprocess:
4545
@echo '```' >> docs/docs/cli.md
4646
@echo "" >> docs/docs/cli.md
4747
@echo '```' >> docs/docs/cli.md
48-
@uv run reprex --help >> docs/docs/cli.md
48+
@COLUMNS=80 uv run reprex --help >> docs/docs/cli.md
4949
@echo '```' >> docs/docs/cli.md
5050
sed 's|https://raw.githubusercontent.com/jayqi/reprexlite/main/docs/docs/images/demo.gif|images/demo.gif|g' README.md \
5151
| sed 's|https://jayqi.github.io/reprexlite/stable/||g' \

reprexlite/config.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class ParsingMethod(str, Enum):
1515
"""Methods for parsing input strings.
1616
17-
Args:
17+
Attributes:
1818
AUTO (str): Automatically identify reprex-style or doctest-style input.
1919
DECLARED (str): Use configured values for parsing.
2020
"""
@@ -24,7 +24,17 @@ class ParsingMethod(str, Enum):
2424

2525

2626
class Venue(str, Enum):
27-
"""Enum for specifying the output venue for a reprex."""
27+
"""Enum for specifying the output venue for a reprex.
28+
29+
Attributes:
30+
GH (str): GitHub-flavored Markdown
31+
DS (str): Discourse
32+
SO (str): StackOverflow
33+
HTML (str): HTML
34+
PY (str): Python script
35+
RTF (str): Rich Text Format
36+
SLACK (str): Slack markup
37+
"""
2838

2939
GH = "gh"
3040
DS = "ds"
@@ -41,9 +51,9 @@ class ReprexConfig:
4151
formatting.
4252
4353
Args:
44-
editor (str): Command-line program name of editor to use. If not specified, check $EDITOR
45-
and $VISUAL environment variables. If 'ipython', will launch the IPython interactive
46-
editor.
54+
editor (Optional[str]): Command-line program name of editor to use. If not specified,
55+
check $EDITOR and $VISUAL environment variables. If 'ipython', will launch the IPython
56+
interactive editor.
4757
venue (str): Key to identify the output venue that the reprex will be shared in. Used to
4858
select an appropriate formatter. See "Venues Formatting" documentation for formats
4959
included with reprexlite.

reprexlite/reprexes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RawResult:
2626
"""Class that holds the result of evaluated code. Use `str(...)` on an instance to produce a
2727
pretty-formatted comment block representation of the result.
2828
29-
Attributes:
29+
Args:
3030
config (ReprexConfig): Configuration for formatting and parsing
3131
raw (Any): Some Python object that is the raw return value of evaluated Python code.
3232
stdout (str): Standard output from evaluated Python code.
@@ -69,7 +69,7 @@ def __eq__(self, other: Any) -> bool:
6969
class ParsedResult:
7070
"""Class that holds parsed result from reading a reprex.
7171
72-
Attributes:
72+
Args:
7373
config (ReprexConfig): Configuration for formatting and parsing
7474
lines (List[str]): String content of result parsed from a reprex
7575
"""
@@ -115,7 +115,7 @@ def __eq__(self, other: Any) -> bool:
115115
class Statement:
116116
"""Dataclass that holds a LibCST parsed statement. of code.
117117
118-
Attributes:
118+
Args:
119119
config (ReprexConfig): Configuration for formatting and parsing
120120
stmt (Union[libcst.SimpleStatementLine, libcst.BaseCompoundStatement]): LibCST parsed
121121
statement.
@@ -227,7 +227,7 @@ def __eq__(self, other: Any) -> bool:
227227
class Reprex:
228228
"""Dataclass for a reprex, which holds Python code and results from evaluation.
229229
230-
Attributes:
230+
Args:
231231
config (ReprexConfig): Configuration for formatting and parsing
232232
statements (List[Statement]): List of parsed Python code statements
233233
results (List[RawResult]): List of results evaluated from statements

uv.lock

+3-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)