Skip to main content

Simple (pythonic) MarkDown Generator

Modules to programmatically generate MarkDown source code in a pythonic way

pip install smdg

Installation in a virtual environment is strongly recommended.

Example usage

Use the classes in the smdg.elements module to create MarkDown elements.

Some elements may be nested, and the smdg.elements.render() function can be used to return a MarkDown document (consisting of the provided elements) as a single string.

>>> from smdg import elements as me
>>>
>>> h1 = me.Header(1, "Main header")
>>> h2 = me.Header(2, "Printing colors:")
>>> p = me.Paragraph("Lorem ipsum dolor sit amet,\nconsectetuer adipiscing elit.")
>>> pre = me.CodeBlock('def main() -> int:\n    """main function"""\n    return 0')
>>> ul = me.UnorderedList("Cyan", "Magenta", "Yellow", "Key")
>>>
>>> print(h1)
# Main header
>>> print(h2)
## Printing colors:
>>> print(p)
Lorem ipsum dolor sit amet,
consectetuer adipiscing elit.
>>>
>>> print(me.render(h1, p, pre, h2, ul))
# Main header

Lorem ipsum dolor sit amet,
consectetuer adipiscing elit.

    def main() -> int:
        """main function"""
        return 0

## Printing colors:

*   Cyan
*   Magenta
*   Yellow
*   Key
>>>
>>> print(me.BlockQuote(h1, p, pre, h2, ul))
> # Main header
>
> Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit.
>
>     def main() -> int:
>         """main function"""
>         return 0
>
> ## Printing colors:
>
> *   Cyan
> *   Magenta
> *   Yellow
> *   Key
>>>

Further reading

Please see the documentation at https://blackstream-x.gitlab.io/smdg for detailed usage information.

If you found a bug or have a feature suggestion, please open an issue here

Metadata

Release files for smdg 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smdg 0.2.1
File Size Uploaded
smdg-0.2.1.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smdg 0.2.1
File Interpreter ABI Platform
smdg-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / smdg-0.2.1.tar.gz

Download URL smdg-0.2.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
94a396803c86092f7a9a5adedf728c11e057335355b0707e7aaed55777398612
BLAKE2b-256 checksum
How to use checksums
99807bb65d8506afa0ef84660bbf2e9d416b7092cdca62feccb9ea5bcc37d142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / smdg-0.2.1-py3-none-any.whl

Download URL smdg-0.2.1-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dbb47ff13e92329f86e2a26b78adbc4efbcd107e2f5c1ccde960cca3799c5f6
BLAKE2b-256 checksum
How to use checksums
dce2383ea7d227288ae5b91f531301d2176f0443a243db5300c3a7a8da2f9dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page