google styled doc string
This commit is contained in:
@@ -133,7 +133,7 @@ Models:
|
||||
|
||||
---
|
||||
|
||||
## Google-Styled Doc-Forge Convention (GSDFC)
|
||||
# Google-Styled Doc-Forge Convention (GSDFC)
|
||||
|
||||
GSDFC defines how docstrings must be written so they render correctly in MkDocs and remain machine-parsable by doc-forge and AI tooling.
|
||||
|
||||
@@ -144,7 +144,7 @@ GSDFC defines how docstrings must be written so they render correctly in MkDocs
|
||||
|
||||
---
|
||||
|
||||
### General rules
|
||||
## General rules
|
||||
|
||||
- Use **Markdown headings** at package and module level.
|
||||
- Use **Google-style structured sections** at class, function, and method level.
|
||||
@@ -155,7 +155,7 @@ GSDFC defines how docstrings must be written so they render correctly in MkDocs
|
||||
|
||||
---
|
||||
|
||||
### Package docstrings
|
||||
## Package docstrings
|
||||
|
||||
- Package docstrings act as the documentation home page.
|
||||
|
||||
@@ -182,13 +182,13 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
# Installation
|
||||
|
||||
pip install foo-bar
|
||||
|
||||
---
|
||||
|
||||
## Quick start
|
||||
# Quick start
|
||||
|
||||
from foobar import Foo, BarEngine
|
||||
|
||||
@@ -199,7 +199,7 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
## Public API
|
||||
# Public API
|
||||
|
||||
Foo
|
||||
Bar
|
||||
@@ -210,7 +210,7 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Module docstrings
|
||||
## Module docstrings
|
||||
|
||||
- Module docstrings describe a subsystem.
|
||||
|
||||
@@ -246,7 +246,7 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Class docstrings
|
||||
## Class docstrings
|
||||
|
||||
- Class docstrings define object responsibility, lifecycle, and attributes.
|
||||
|
||||
@@ -315,7 +315,7 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Function and method docstrings
|
||||
## Function and method docstrings
|
||||
|
||||
- Function docstrings define API contracts.
|
||||
|
||||
@@ -397,16 +397,12 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Property docstrings
|
||||
## Property docstrings
|
||||
|
||||
- Properties must document return values.
|
||||
|
||||
Example:
|
||||
|
||||
class FooContainer:
|
||||
'''
|
||||
Container for Foo objects.
|
||||
'''
|
||||
Property Doc String:
|
||||
|
||||
@property
|
||||
def foos(self) -> tuple[Foo, ...]:
|
||||
@@ -425,13 +421,13 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Attribute documentation
|
||||
## Attribute documentation
|
||||
|
||||
- Document attributes in class docstrings using Attributes:.
|
||||
|
||||
Example:
|
||||
Attribute Doc String:
|
||||
|
||||
class Bar:
|
||||
'''
|
||||
Represents a processing stage.
|
||||
|
||||
@@ -445,11 +441,12 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Notes subsection grouping
|
||||
## Notes subsection grouping
|
||||
|
||||
- Group related information using labeled subsections.
|
||||
|
||||
Example:
|
||||
Notes Example:
|
||||
|
||||
Notes:
|
||||
**Guarantees:**
|
||||
@@ -467,18 +464,19 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
### Example formatting
|
||||
## Example formatting
|
||||
|
||||
- Use indentation for examples.
|
||||
|
||||
Single example:
|
||||
Example:
|
||||
Single example:
|
||||
|
||||
Example:
|
||||
|
||||
foo = Foo("example")
|
||||
process(foo, multiplier=2)
|
||||
|
||||
Multiple examples:
|
||||
Multiple examples:
|
||||
|
||||
Example:
|
||||
Create foo:
|
||||
@@ -494,7 +492,7 @@ Avoid fenced code blocks inside structured sections.
|
||||
|
||||
---
|
||||
|
||||
### Separator rules
|
||||
## Separator rules
|
||||
|
||||
Use horizontal separators only at docstring root level to separate sections:
|
||||
|
||||
@@ -510,7 +508,7 @@ Do not use separators inside code sections.
|
||||
|
||||
---
|
||||
|
||||
### Parsing guarantees
|
||||
## Parsing guarantees
|
||||
|
||||
GSDFC ensures doc-forge can deterministically extract:
|
||||
|
||||
@@ -530,11 +528,9 @@ This enables:
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
doc-forge never executes analyzed modules.
|
||||
|
||||
Documentation is generated entirely through static analysis.
|
||||
Notes:
|
||||
- doc-forge never executes analyzed modules.
|
||||
- Documentation is generated entirely through static analysis.
|
||||
"""
|
||||
|
||||
from .loaders import GriffeLoader, discover_module_paths
|
||||
|
||||
Reference in New Issue
Block a user