A comprehensive Python library for programmatically creating and manipulating Markdown files with support for headers, tables, lists, images, links, and text formatting.
80
Create a Python program that generates a formatted Markdown report with a predefined structure but dynamically populated content. The report should be built using a template-first approach where placeholders are created for sections that will be filled in later after data processing.
Your program should:
Create a Markdown document with the following structure:
After establishing the structure, populate the placeholders with computed data:
Save the final document as performance_report.md
Given metrics data [["CPU Usage", "75%", "Good"], ["Memory", "82%", "Warning"], ["Disk I/O", "45%", "Good"]], the generated report contains a properly formatted table with these three rows under the "Detailed Metrics" section. @test
Given the structure is created with placeholders first, and content is added to placeholders later, the final document has the correct order: Title, Summary (with content), Detailed Metrics (with table), Recommendations (with list), and Conclusion. @test
The generated file performance_report.md exists and contains valid Markdown with all sections properly populated. @test
@generates
def generate_report(metrics_data: list, summary_text: str, recommendations: list) -> None:
"""
Generate a performance report with the given data.
Args:
metrics_data: A 2D list where each inner list contains [metric_name, value, status]
summary_text: Text describing the overall summary
recommendations: List of recommendation strings
Creates a file named 'performance_report.md' with the formatted report.
"""
passProvides Markdown file creation and formatting capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-mdutilsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10