Format code examples in markdown documentation for TalkPipe. Use when writing or editing doc examples. Covers unindented fences, standalone vs fragment intent, and skip-extract. Complements run-documentation-examples which runs the examples.
81
73%
Does it follow best practices?
Impact
93%
1.16xAverage score across 3 eval scenarios
Passed
No known issues
Fix and improve this skill with Tessl
tessl review fix ./.cursor/skills/doc-example-formatting/SKILL.mdFormat code blocks in markdown so they render correctly and can be extracted for testing. See docs/architecture/documentation-formatting.md for full guidelines.
Place the opening fence at the start of the line (no leading spaces):
```python
from talkpipe.pipe import io
pipeline = io.echo(data="hello") | io.Print()
result = pipeline.as_function(single_out=False)()**Why**: Unindented blocks are easier for extractors to parse. Indented fences (e.g. inside lists) are supported but unindented is preferred.
### Language tag
Always include the language: ` ```python ` for Python, ` ```chatterlang ` or ` ``` ` for ChatterLang. Enables syntax highlighting and lets extractors identify example types.
## Example Intent
Make it clear whether an example is:
- **Standalone runnable**: Complete code users can copy and run. Include all imports, sources, and output.
- **Explanatory fragment**: Partial code illustrating a concept. Add context like "Part of the pipeline above..." or a comment.
## Skip Extraction
Add `# skip-extract` as the first line of a block to exclude it from the doc examples runner:
```python
# skip-extract
from setuptools import setup
setup(name="myproject", ...)Use skip-extract when:
Good (standalone, unindented):
```python
from talkpipe.pipe import io
pipeline = io.echo(data="hello") | io.Print()
pipeline.as_function(single_out=False)()
```Bad (no language tag):
```
code here
```Bad (nested backticks inside block): Avoid triple backticks within the code content; they can break extraction.
After editing docs, run the doc examples to verify they execute:
pytest tests/test_doc_examples.py -vOr use the run-documentation-examples skill. Skip LLM examples when Ollama unavailable: pytest tests/test_doc_examples.py -m "not requires_ollama" -v
0cf1686
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.