Skip to main content

Simple (pythonic) MarkDown Generator

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smdg-0.2.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

smdg-0.2.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file smdg-0.2.0.tar.gz.

File metadata

  • Download URL: smdg-0.2.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for smdg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5611f066b664297e157be9f13929223b543f3e86b04825e13dfcbaabe829f176
MD5 9e2ebb2fb9a4c513fbef91559bed1c80
BLAKE2b-256 683ed131dd62aecbb0453b3686a935d2fa079f01da54899bab6c8168339a4031

See more details on using hashes here.

File details

Details for the file smdg-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: smdg-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for smdg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5eb023fbbde8f8260eb72652899a5a569c45be34b10e6f3d9bd2af1453cc8a3
MD5 29a102c81da523578cf3bcf14e410212
BLAKE2b-256 b830df3e028b64b2fa204a33f2eef93d8fd1bcc07cf7406f312b47258ccd9e44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page