Home / Companies / Hugging Face / Blog / Post Details
Content Deep Dive

From doctest to runnable Markdown

Blog post from Hugging Face

Post Details
Company
Date Published
Author
Tarek Ziadé
Word Count
1,460
Company Posts That Month
61
Language
-
Hacker News Points
-
Post removed?
No
Summary

Python's principle that documentation examples should be executable has evolved with the introduction of runnable code blocks in Markdown by Hugging Face. This feature, incorporated into the doc-builder project, allows examples to function as both documentation and tests without needing separate formats. Historically, Python's doctest enabled examples in documentation to double as regression tests, but it became cumbersome as projects grew due to the need for setup, teardown, and complex assertions within examples. In contrast, Hugging Face's approach treats Markdown snippets as standard Python code, which integrates seamlessly with pytest, enabling examples to be tested automatically while keeping documentation clean and readable. This modern method maintains the integrity of documentation by ensuring examples remain valid and functional, which is particularly valuable for large projects with extensive documentation and code examples, such as the Transformers library. The feature aims to prevent documentation drift and ensure examples are reliable by continuously testing them, aligning with the original objective of executable documentation.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Vector Search 2 1,739 413 146 -27%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.