mdutils is a useful Python package for programmatically creating Markdown files. It provides methods to generate headers, lists, tables, links, images, and format text while executing Python code. The current version is 1.8.1, and the library is actively maintained with regular updates including new features, bug fixes, and general maintenance.
pip install mdutilsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `MdUtils` class, add various Markdown elements like headers, paragraphs, lists, and tables, and then generate the `.md` file. The `create_md_file()` method is always the last call to write the content to disk.
Ensure `text_align` is a single string (e.g., `'center'`) for global alignment, or a list of strings (e.g., `['left', 'center', 'right']`) for column-specific alignment.
Upgrade to v1.8.1 or later. If unable to upgrade, avoid starting list items with Markdown bold syntax when using `new_list`.
Upgrade to v1.7.0 or later to ensure correct spacing. Review any downstream parsing logic if you were handling unexpected spaces from `new_line()`.
Upgrade to v1.2.2 or later to ensure TOC links with special characters are correctly rendered. Older versions might require manual sanitization of header titles for reliable TOC links.
Install the library using pip: `pip install mdutils`
Import the 'MdUtils' class directly from the 'mdutils.mdutils' module: `from mdutils.mdutils import MdUtils`
Ensure a value is provided for the `reference_tag` parameter whenever `bold_italics_code` is used with `new_reference_link`.
Pass `text_align` as a single string (e.g., `'center'`) for global alignment or a list of strings (e.g., `['left', 'center', 'right']`) for column-specific alignment, matching the expected type for your `mdutils` version and desired functionality.
No dependency data recorded yet.