CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-mdutils

A comprehensive Python library for programmatically creating and manipulating Markdown files with support for headers, tables, lists, images, links, and text formatting.

80

1.90x
Overview
Eval results
Files

task.mdevals/scenario-10/

Dynamic Report Generator

Build a report generation system that creates structured reports from templates using placeholder markers.

Capabilities

Creates document structure with placeholders

The system must be able to create a document outline with multiple sections, where specific content locations are marked with placeholders for later insertion.

  • Given a title "Sales Report Q4 2024", create a document with headers for "Executive Summary", "Sales Data", and "Recommendations", and insert placeholder markers for the summary content, sales table, and recommendations list @test

Populates template with dynamic content

The system must be able to insert content into previously created placeholder locations after the document structure is defined.

  • After creating a structure with a "results_table" placeholder, when provided with a 2D array of sales data [['Region', 'Q1', 'Q2'], ['North', '100K', '120K'], ['South', '80K', '95K']], insert a formatted table at that placeholder location @test
  • After creating a structure with a "summary_text" placeholder, when provided with text "Total revenue increased by 15% compared to last year", insert that text at the placeholder location @test

Generates complete report file

The system must be able to save the fully populated template to a markdown file.

  • After populating all placeholders in a report template, calling the generation method creates a file "report.md" with all content properly formatted and placeholders replaced @test

Implementation

@generates

API

class ReportGenerator:
    """
    A report generator that creates structured markdown reports using templates.
    """

    def __init__(self, title: str, filename: str):
        """
        Initialize the report generator.

        Args:
            title: The title of the report
            filename: The output filename (without .md extension)
        """
        pass

    def create_section(self, level: int, heading: str) -> None:
        """
        Create a section header in the report.

        Args:
            level: Header level (1-6)
            heading: The heading text
        """
        pass

    def create_placeholder(self, name: str) -> None:
        """
        Create a placeholder marker in the document for later content insertion.

        Args:
            name: Unique name for the placeholder
        """
        pass

    def insert_table(self, placeholder_name: str, data: list[list[str]]) -> None:
        """
        Insert a table at the specified placeholder location.

        Args:
            placeholder_name: Name of the placeholder to replace
            data: 2D array where first row is headers, remaining rows are data
        """
        pass

    def insert_text(self, placeholder_name: str, text: str) -> None:
        """
        Insert text content at the specified placeholder location.

        Args:
            placeholder_name: Name of the placeholder to replace
            text: Text content to insert
        """
        pass

    def generate(self) -> str:
        """
        Generate the complete report and save to file.

        Returns:
            The path to the generated markdown file
        """
        pass

Dependencies { .dependencies }

mdutils { .dependency }

Provides markdown document generation capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-mdutils

tile.json