Skip to main content

Python tool to write Markdown easily.

Project description

MarkdownIO

Pypi Version Python Version Build Status Coverage Status Project license

Python tool to write Markdown easily.

Installation

$ pip install markdownio

Usage

from markdownio import MarkdownIO, block, span


markdown = MarkdownIO()

title = block.Header1("My test document")
markdown.add(title)

text_p1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus " \
          "rutrum consequat " + span.bold("odio") + " et mollis."
p1 = block.Paragraph(text_p1)
markdown.add(p1)

img = block.Paragraph(span.image(path="path/img.jpg", alt="img", title="img"))
markdown.add(img)

table = block.Table(columns=3)
table.set_headers(['Col1', 'Col2', 'Col3'])
table.add_row(['foo', 'bar', 'foobar'])
table.add_row(['oof', 'rab', 2000])
markdown.add(table)

text_p2 = "This is an interesting article: " + span.link(path='http://test.io')
p2 = block.Paragraph(text_p2)
markdown.add(p2)

subtitle = block.Header2("Code example")
markdown.add(subtitle)

code = block.Code('<p>Test</p>', language='html')
markdown.add(code)

print(markdown.output())

output:

# My test document

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus rutrum consequat **odio** et mollis.

![img](path/img.jpg "img")

| Col1 | Col2 | Col3   |
| ---- | ---- | ------ |
| foo  | bar  | foobar |
| oof  | rab  | 2000   |

This is an interesting article: <http://test.io>

## Code example

```html
<p>Test</p>
\```

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

markdownio-0.0.2.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

markdownio-0.0.2-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

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