Skip to content

Commit d736dfd

Browse files
refactor(docs): code analysis engine
changes: - file: __init__.py area: core removed: [table, _get_table_chars] - file: ansi.py area: core added: [is_no_color, supports_color, strip_ansi] - file: highlighting.py area: core added: [HighlightRule, _make_highlighters, highlight_code] - file: logger.py area: core modified: [Logger, __init__] - file: renderer.py area: core modified: [render_to_string, codeblock, __init__, MarkdownRenderer] removed: [_supports_color, _highlight_code, _HL, _make_highlighters, _is_no_color, strip_ansi] - file: tables.py area: core added: [_calculate_column_widths, _render_table_rows, _render_markdown_table, _render_table_header, _get_table_chars, _render_table_border, +1 more] dependencies: flow: "tables→renderer→ansi" - highlighting.py -> ansi.py - renderer.py -> ansi.py - renderer.py -> highlighting.py - tables.py -> renderer.py stats: lines: "+934/-703 (net +231)" files: 29 complexity: "+36% complexity (new features)"
1 parent da83278 commit d736dfd

33 files changed

Lines changed: 965 additions & 706 deletions

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [0.1.10] - 2026-03-27
99

10+
### Fixed
11+
- Fix magic-numbers issues (ticket-50c6d50a)
12+
- Fix relative-imports issues (ticket-3450003e)
13+
- Fix relative-imports issues (ticket-8871b38a)
14+
- Fix llm-generated-code issues (ticket-235b03a9)
15+
16+
## [0.1.10] - 2026-03-27
17+
18+
### Fixed
19+
- Fix relative-imports issues (ticket-53a8b762)
20+
- Fix relative-imports issues (ticket-d9ee608d)
21+
22+
## [0.1.10] - 2026-03-27
23+
1024
### Fixed
1125
- Fix smart-return-type issues (ticket-1aaadf0b)
1226
- Fix ai-boilerplate issues (ticket-8b31945f)
@@ -31,6 +45,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3145

3246
## [Unreleased]
3347

48+
## [0.1.4] - 2026-03-27
49+
50+
### Docs
51+
- Update CHANGELOG.md
52+
- Update TODO.md
53+
- Update docs/README.md
54+
- Update project/README.md
55+
- Update project/context.md
56+
57+
### Other
58+
- Update examples/basic.py
59+
- Update examples/logger_usage.py
60+
- Update examples/table_styles_demo.py
61+
- Update examples/tables_panels.py
62+
- Update planfile.yaml
63+
- Update project/analysis.toon.yaml
64+
- Update project/calls.mmd
65+
- Update project/calls.png
66+
- Update project/compact_flow.mmd
67+
- Update project/compact_flow.png
68+
- ... and 9 more files
69+
3470
## [0.1.3] - 2026-03-27
3571

3672
### Docs

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,16 @@ pytest
241241

242242
## License
243243

244+
Licensed under Apache-2.0.
245+
246+
244247
Apache License 2.0 - see [LICENSE](LICENSE) for details.
245248

246249
## Author
247250

251+
Tom Sapletta
252+
253+
248254
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
249255

250256
## Related Projects

TODO.md

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,29 @@
11
# TODO
22

3-
**Generated by:** prefact v0.1.26
4-
**Generated on:** 2026-03-27T17:20:53.533233
5-
**Total issues:** 17 active, 24 completed
3+
**Generated by:** prefact v0.1.28
4+
**Generated on:** 2026-03-27T18:32:23.639484
5+
**Total issues:** 16 active, 0 completed
66

77
---
88

9-
## ✅ Completed Tasks
10-
11-
- [x] examples/table_styles_demo.py:9 - Function 'demo' missing return type (suggested: -> None)
12-
- [x] examples/basic.py:9 - Function 'hello' missing return type (suggested: -> None)
13-
- [x] examples/basic.py:34 - Function 'status' missing return type (suggested: -> None)
14-
- [x] examples/basic.py:51 - Function 'demo' missing return type (suggested: -> None)
15-
- [x] examples/tables_panels.py:10 - Function 'deps' missing return type (suggested: -> None)
16-
- [x] examples/tables_panels.py:26 - Function 'info' missing return type (suggested: -> None)
17-
- [x] examples/logger_usage.py:11 - Function 'deploy' missing return type (suggested: -> None)
18-
- [x] src/typermd/__init__.py:339 - String concatenation can be converted to f-string
19-
- [x] src/typermd/__init__.py:261 - String concatenation can be converted to f-string
20-
- [x] src/typermd/__init__.py:265 - String concatenation can be converted to f-string
21-
- [x] src/typermd/__init__.py:20 - Unused import: 'annotations'
22-
- [x] src/typermd/__init__.py:120 - LLM-style docstring in echo
23-
- [x] src/typermd/__init__.py:234 - LLM-style docstring in table
24-
- [x] src/typermd/logger.py:56 - String concatenation can be converted to f-string
25-
- [x] src/typermd/logger.py:16 - Unused import: 'annotations'
26-
- [x] src/typermd/renderer.py:334 - String concatenation can be converted to f-string
27-
- [x] src/typermd/renderer.py:328 - String concatenation can be converted to f-string
28-
- [x] src/typermd/renderer.py:7 - Unused import: 'annotations'
29-
- [x] src/typermd/renderer.py:87 - Magic number: 20 - use named constant
30-
- [x] src/typermd/renderer.py:320 - Magic number: 80 - use named constant
31-
- [x] src/typermd/renderer.py:359 - Magic number: 42 - use named constant
32-
- [x] src/typermd/help.py:16 - Unused import: 'annotations'
33-
- [x] src/typermd/help.py:84 - LLM-style docstring in install_help_formatter
34-
- [x] src/typermd/themes.py:12 - Unused import: 'annotations'
35-
369
## 📋 Current Issues
3710

38-
- [ ] examples/tables_panels.py:34 - module execution block
39-
- [ ] examples/table_styles_demo.py:26 - module execution block
40-
- [ ] examples/logger_usage.py:31 - module execution block
4111
- [ ] examples/basic.py:95 - module execution block
42-
- [ ] src/typermd/__init__.py:338 - String concatenation can be converted to f-string
43-
- [ ] src/typermd/__init__.py:281 - String concatenation can be converted to f-string
44-
- [ ] src/typermd/__init__.py:300 - String concatenation can be converted to f-string
45-
- [ ] src/typermd/__init__.py:119 - LLM-style docstring in echo
46-
- [ ] src/typermd/__init__.py:233 - LLM-style docstring in table
47-
- [ ] src/typermd/__init__.py:16 - module execution block
48-
- [ ] src/typermd/renderer.py:346 - String concatenation can be converted to f-string
49-
- [ ] src/typermd/renderer.py:171 - String concatenation can be converted to f-string
50-
- [ ] src/typermd/renderer.py:229 - String concatenation can be converted to f-string
51-
- [ ] src/typermd/renderer.py:18 - Magic number: 20 - use named constant
52-
- [ ] src/typermd/renderer.py:19 - Magic number: 80 - use named constant
53-
- [ ] src/typermd/renderer.py:20 - Magic number: 42 - use named constant
12+
- [ ] examples/logger_usage.py:31 - module execution block
13+
- [ ] examples/table_styles_demo.py:26 - module execution block
14+
- [ ] examples/tables_panels.py:34 - module execution block
15+
- [ ] src/typermd/__init__.py:158 - Relative import (level=1): '.tables'
16+
- [ ] src/typermd/ansi.py:15 - Magic number: 20 - use named constant
17+
- [ ] src/typermd/ansi.py:16 - Magic number: 80 - use named constant
18+
- [ ] src/typermd/ansi.py:17 - Magic number: 42 - use named constant
19+
- [ ] src/typermd/highlighting.py:10 - Relative import (level=1): '.ansi'
20+
- [ ] src/typermd/highlighting.py:184 - LLM-style docstring in highlight_code
21+
- [ ] src/typermd/renderer.py:13 - Relative import (level=1): '.ansi'
22+
- [ ] src/typermd/renderer.py:36 - Relative import (level=1): '.highlighting'
5423
- [ ] src/typermd/help.py:83 - LLM-style docstring in install_help_formatter
24+
- [ ] src/typermd/tables.py:10 - Relative import (level=1): '.renderer'
25+
- [ ] src/typermd/tables.py:89 - Relative import (level=1): '.renderer'
26+
- [ ] src/typermd/tables.py:198 - Relative import (level=1): '.renderer'
5527

5628
---
5729

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.3
1+
0.1.4

docs/README.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- code2docs:start --># typermd
22

3-
![version](https://img.shields.io/badge/version-0.1.0-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.10-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-61-green)
4-
> **61** functions | **5** classes | **10** files | CC̄ = 2.8
3+
![version](https://img.shields.io/badge/version-0.1.0-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.10-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-66-green)
4+
> **66** functions | **5** classes | **13** files | CC̄ = 2.7
55
66
> Auto-generated project documentation from source code analysis.
77
@@ -146,30 +146,39 @@ Content outside the markers is preserved when regenerating. Enable this with `sy
146146

147147
```
148148
typermd/
149-
├── tables_panels ├── table_styles_demo ├── typermd/ ├── basic ├── logger_usage ├── logger├── project ├── themes ├── renderer ├── help```
149+
├── logger_usage ├── basic ├── ansi ├── typermd/ ├── table_styles_demo ├── tables ├── renderer ├── tables_panels ├── logger├── project ├── themes ├── highlighting ├── help```
150150
151151
## API Overview
152152
153153
### Classes
154154
155+
- **`MarkdownRenderer`** — Renders markdown text to the terminal with ANSI colors.
155156
- **`Logger`** — Markdown-aware structured logger.
156157
- **`Theme`** — Color theme definition with named color slots.
157-
- **`MarkdownRenderer`** — Renders markdown text to the terminal with ANSI colors.
158+
- **`HighlightRule`** — Highlighter rule: pattern + color.
158159
- **`MarkdownHelpFormatter`** — Click HelpFormatter that renders markdown in help text.
159160
160161
### Functions
161162
162-
- `deps()` — Show project dependencies as a table.
163-
- `info()` — Show app info in a panel.
164-
- `demo()` — Demonstrate all table styles.
165-
- `echo(message, file, nl, err)` — Enhanced echo that auto-detects and renders markdown.
166-
- `table(headers, rows, style)` — Render a table to the terminal.
167-
- `panel(content, title, style_color)` — Render a bordered panel.
168-
- `blockquote(content)` — Render a blockquote.
163+
- `deploy(env, dry_run)` — Simulate a deployment with structured logging.
169164
- `hello(name, formal)` — Say hello with markdown formatting.
170165
- `status()` — Show system status with styled output.
171166
- `demo()` — Demonstrate all markdown features.
172-
- `deploy(env, dry_run)` — Simulate a deployment with structured logging.
167+
- `strip_ansi(text)` — Remove all ANSI escape codes from text.
168+
- `is_no_color()` — Check if NO_COLOR env is set (https://no-color.org).
169+
- `supports_color(stream)` — Detect if the output stream supports color.
170+
- `echo(message, file, nl, err)` — Enhanced echo that auto-detects and renders markdown.
171+
- `panel(content, title, style_color)` — Render a bordered panel.
172+
- `blockquote(content)` — Render a blockquote.
173+
- `demo()` — Demonstrate all table styles.
174+
- `table(headers, rows, style)` — Render a table to the terminal.
175+
- `looks_like_markdown(text)` — Heuristic: does the text contain markdown formatting?
176+
- `get_renderer(stream, use_colors)` — Get or create the default MarkdownRenderer.
177+
- `render_markdown(text, stream, use_colors)` — Render markdown text to a stream.
178+
- `md(text)` — Render markdown text to stdout. Primary convenience function.
179+
- `render_to_string(text)` — Render markdown and return as string.
180+
- `deps()` — Show project dependencies as a table.
181+
- `info()` — Show app info in a panel.
173182
- `get_logger(name, verbose)` — Get or create the default logger.
174183
- `set_logger(logger)` — Replace the default logger.
175184
- `get_theme()` — Get the current active theme.
@@ -178,12 +187,7 @@ typermd/
178187
- `list_themes()` — Return list of available theme names.
179188
- `is_no_color()` — Check if NO_COLOR env is set.
180189
- `init_theme_from_env()` — Initialize theme from TYPERMD_THEME env variable.
181-
- `strip_ansi(text)` — Remove all ANSI escape codes from text.
182-
- `looks_like_markdown(text)` — Heuristic: does the text contain markdown formatting?
183-
- `get_renderer(stream, use_colors)` — Get or create the default MarkdownRenderer.
184-
- `render_markdown(text, stream, use_colors)` — Render markdown text to a stream.
185-
- `md(text)` — Render markdown text to stdout. Primary convenience function.
186-
- `render_to_string(text)` — Render markdown and return as string.
190+
- `highlight_code(code, lang)` — Apply syntax highlighting to a code block.
187191
- `install_help_formatter(app)` — Install the markdown help formatter on a Typer app.
188192
189193
@@ -194,10 +198,13 @@ typermd/
194198
📄 `examples.table_styles_demo` (1 functions)
195199
📄 `examples.tables_panels` (2 functions)
196200
📄 `project`
197-
📦 `src.typermd` (5 functions)
201+
📦 `src.typermd` (3 functions)
202+
📄 `src.typermd.ansi` (3 functions)
198203
📄 `src.typermd.help` (6 functions, 1 classes)
204+
📄 `src.typermd.highlighting` (2 functions, 1 classes)
199205
📄 `src.typermd.logger` (12 functions, 1 classes)
200-
📄 `src.typermd.renderer` (24 functions, 2 classes)
206+
📄 `src.typermd.renderer` (19 functions, 1 classes)
207+
📄 `src.typermd.tables` (7 functions)
201208
📄 `src.typermd.themes` (7 functions, 1 classes)
202209
203210
## Requirements
@@ -208,8 +215,8 @@ typermd/
208215
## Contributing
209216
210217
**Contributors:**
211-
- Tom Sapletta <tom-sapletta-com@users.noreply.github.com>
212218
- Tom Softreck <tom@sapletta.com>
219+
- Tom Sapletta <tom-sapletta-com@users.noreply.github.com>
213220
214221
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
215222

examples/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ def demo() -> None:
9393

9494

9595
if __name__ == "__main__":
96-
typer.Typer()
96+
app()

examples/logger_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ def deploy(
2929

3030

3131
if __name__ == "__main__":
32-
typer.Typer()
32+
deploy()

examples/table_styles_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def demo() -> None:
2424
typer.table(headers, rows, style=style)
2525

2626
if __name__ == "__main__":
27-
typer.Typer()
27+
app()

examples/tables_panels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ def info() -> None:
3232

3333

3434
if __name__ == "__main__":
35-
typer.Typer()
35+
app()

planfile.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,81 @@ sprints:
277277
model_hints:
278278
planning: balanced
279279
implementation: balanced
280+
- id: ticket-53a8b762
281+
name: Fix relative-imports issues
282+
description: Resolve 1 relative-imports issues in src/typermd/__init__.py
283+
task_type: prefactor
284+
priority: medium
285+
estimate: 1d
286+
files:
287+
- src/typermd/__init__.py
288+
rule_id: relative-imports
289+
count: 1
290+
model_hints:
291+
planning: balanced
292+
implementation: balanced
293+
- id: ticket-d9ee608d
294+
name: Fix relative-imports issues
295+
description: Resolve 3 relative-imports issues in src/typermd/tables.py
296+
task_type: prefactor
297+
priority: medium
298+
estimate: 1d
299+
files:
300+
- src/typermd/tables.py
301+
rule_id: relative-imports
302+
count: 3
303+
model_hints:
304+
planning: balanced
305+
implementation: balanced
306+
- id: ticket-50c6d50a
307+
name: Fix magic-numbers issues
308+
description: Resolve 3 magic-numbers issues in src/typermd/ansi.py
309+
task_type: prefactor
310+
priority: medium
311+
estimate: 1d
312+
files:
313+
- src/typermd/ansi.py
314+
rule_id: magic-numbers
315+
count: 3
316+
model_hints:
317+
planning: balanced
318+
implementation: balanced
319+
- id: ticket-3450003e
320+
name: Fix relative-imports issues
321+
description: Resolve 2 relative-imports issues in src/typermd/renderer.py
322+
task_type: prefactor
323+
priority: medium
324+
estimate: 1d
325+
files:
326+
- src/typermd/renderer.py
327+
rule_id: relative-imports
328+
count: 2
329+
model_hints:
330+
planning: balanced
331+
implementation: balanced
332+
- id: ticket-8871b38a
333+
name: Fix relative-imports issues
334+
description: Resolve 2 relative-imports issues in src/typermd/highlighting.py
335+
task_type: prefactor
336+
priority: medium
337+
estimate: 1d
338+
files:
339+
- src/typermd/highlighting.py
340+
rule_id: relative-imports
341+
count: 2
342+
model_hints:
343+
planning: balanced
344+
implementation: balanced
345+
- id: ticket-235b03a9
346+
name: Fix llm-generated-code issues
347+
description: Resolve 1 llm-generated-code issues in src/typermd/highlighting.py
348+
task_type: prefactor
349+
priority: medium
350+
estimate: 1d
351+
files:
352+
- src/typermd/highlighting.py
353+
rule_id: llm-generated-code
354+
count: 1
355+
model_hints:
356+
planning: balanced
357+
implementation: balanced

0 commit comments

Comments
 (0)