Generate and cache formatted content.
| Parameter | Type | Description | Default |
|---|---|---|---|
| section_type | str | Formatter name | Required |
| header | str | Section header text | Required |
| content | str/list/dict | Main content | "" |
| line | bool | Add separator line | False |
| **kwargs | dict | Type-specific parameters | {} |
Returns: None
Set output file for subsequent docPrint calls.
| Parameter | Type | Description | Default |
|---|---|---|---|
| filepath | str | Target file path | Required |
Special values:
- Empty string
""→ DOC.PRINT.md "."→ DOC.PRINT.md".."→ DOC.PRINT.md
Behavior:
- Creates directories automatically
- Flushes current cache before switching
- Thread-safe operation
Raises: ValueError for invalid characters (< > : " | ? *)
Force write cached content to file immediately.
Parameters: None Returns: None Behavior: No-op if cache is empty
Enable or disable automatic GitHub synchronization.
| Parameter | Type | Description | Default |
|---|---|---|---|
| enabled | bool | Enable/disable sync | Required |
| token | str | GitHub personal access token | Required when enabled |
| repo | str | Repository "username/repository" | Required when enabled |
| interval_minutes | int | Sync interval (minimum 1) | 1 |
Raises:
- ValueError: Invalid token, repository access denied, missing parameters
- ImportError: GitHub integration unavailable
| Parameter | Type | Description | Default |
|---|---|---|---|
| divider_type | str | Divider style | "simple" |
| color | str | Divider color | "#e74c3c" |
| thickness | int | Divider thickness | 2 |
| margin | str | CSS margin | "20px 0" |
| no_header | bool | Skip header display | False |
Valid divider_type values: simple, thick, solid, gradient, dotted, shadow, fade, rainbow, dashed, double
| Parameter | Type | Description | Default |
|---|---|---|---|
| container_style | str | CSS styles for container | "" |
| Parameter | Type | Description | Default |
|---|---|---|---|
| container_style | str | Flex container CSS | "display: flex; gap: 20px;" |
| Parameter | Type | Description | Default |
|---|---|---|---|
| table_style | str | Table element CSS | "width: 100%; border-collapse: collapse;" |
| Parameter | Type | Description | Default |
|---|---|---|---|
| columns | int | Number of grid columns | 2 |
| gap | str | Grid gap size | "10px" |
| Parameter | Type | Description | Default |
|---|---|---|---|
| language | str | Syntax highlighting language | None |
| Parameter | Type | Description | Default |
|---|---|---|---|
| alert_type | str | Alert style | "info" |
Valid alert_type values: info, warning, error, success, note
| Parameter | Type | Description | Default |
|---|---|---|---|
| summary | str | Collapsible summary text | "Details" |
| Parameter | Type | Description | Default |
|---|---|---|---|
| alignment | list | Column alignment per header | ['left', ...] |
Valid alignment values: left, center, right
| Parameter | Type | Description | Default |
|---|---|---|---|
| (content dict) | dict | Badge configuration | {} |
Badge content structure:
{
'label': str, # Badge label
'message': str, # Badge message
'color': str, # Badge color
'style': str, # Badge style (optional)
'url': str, # Click URL (optional)
'logo': str, # Logo name (optional)
'logo_color': str, # Logo color (optional)
'logo_width': str # Logo width (optional)
}| Parameter | Type | Description | Default |
|---|---|---|---|
| (content) | str/dict | URL string or config dict | Required |
Image content structure:
{
'url': str, # Image URL
'alt': str, # Alt text (optional)
'title': str, # Title attribute (optional)
'width': str, # Width attribute (optional)
'height': str # Height attribute (optional)
}| Parameter | Type | Description | Default |
|---|---|---|---|
| (content dict) | dict | HTML configuration | {} |
HTML content structure:
{
'tag': str, # HTML tag name
'attributes': dict, # HTML attributes (optional)
'content': str # Inner content
}| Parameter | Type | Description | Default |
|---|---|---|---|
| (content dict) | dict | CSS configuration | {} |
CSS content structure:
{
'selector': str, # CSS selector
'styles': dict # Style properties
}| Parameter | Type | Description | Default |
|---|---|---|---|
| (content dict) | dict | SVG configuration | {} |
SVG content structure:
{
'width': int, # SVG width
'height': int, # SVG height
'elements': list # SVG elements with animations
}| Formatter | Content Type | Required Structure |
|---|---|---|
| text | str | Plain text |
| header | str | Plain text |
| table | list[dict] | List of row dictionaries |
| advanced_table | dict | {'headers': list, 'rows': list, 'alignment': list} |
| bullets | list[str] | List of bullet points |
| ordered_list | list[str] | List of items |
| unordered_list | list[str] | List of items |
| code_block | str | Code content |
| blockquote | str/list[str] | Quote content |
| alert | str/list[str] | Alert message(s) |
| collapsible | list[str] | Collapsible content items |
| footnotes | tuple | (text, {id: footnote}) |
| definition_list | dict | {term: definition} |
| task_list | list[dict] | [{'task': str, 'completed': bool}] |
| link_collection | list | Mixed URLs and link objects |
| image | str/dict | URL or configuration dict |
| badge | dict | Badge configuration |
| html_block | dict | HTML configuration |
| css_block | dict | CSS configuration |
| svg_animation | dict | SVG configuration |
| flex_layout | list[dict] | Layout block configurations |
| table_layout | list[dict] | Layout block configurations |
| grid_layout | list[dict] | Layout block configurations |
| horizontal_rule | any | Content above the rule |
| divider | str | Optional content (optional) |
For flex_layout, table_layout, grid_layout:
{
'type': str, # Formatter type
'header': str, # Block header
'content': any, # Content for the formatter
'style': str, # CSS styles for block (optional)
'kwargs': dict # Formatter-specific kwargs (optional)
}| Constant | Value | Description |
|---|---|---|
| CACHE_FLUSH_INTERVAL | 30 | Auto-flush interval (seconds) |
| CACHE_FLUSH_COUNT | 1000 | Auto-flush threshold (calls) |
| DOC_FILE_PREFIX | "DOC.PRINT" | Default file prefix |
| DOC_FILE_EXTENSION | ".md" | Default file extension |
| DEFAULT_OUTPUT_DIR | "." | Default output directory |
regex>=2025.9.1(fallback: standardre)xxhash>=3.5.0(fallback:hashlib.md5)
ujson>=5.11.0(GitHub API operations)orjson>=3.11.3(fastest JSON when available)
- Uses urllib from standard library
- Zero overhead when disabled
- Fallback JSON handling maintains compatibility
| Function | Exception | Condition |
|---|---|---|
| docPrintFile | ValueError | Invalid filename characters |
| enableGitCommits | ValueError | Invalid token or repo access |
| enableGitCommits | ImportError | GitHub integration unavailable |
All functions are protected by RLock for concurrent access:
-
Cache operations
-
File handling
-
Content matching
-
GitHub sync operations
-
File switching
-
Formats.md - Complete formatter documentation with examples