Overview
--------
Creating HTML
~~~~~~~~~~~~~
The :py:func:`.markdown_to_html` function takes Markdown text and returns the
equivalent HTML.
>>> import docupy
>>> docupy.markdown_to_html("HTML is easy.")
'
HTML is easy.
'
>>> docupy.markdown_to_html("HTML is easy.\n\nNew paragraph.\r\n\r\nThird.")
'
HTML is easy.
\n
New paragraph.
\n
Third.
'
Formatting
~~~~~~~~~~
Basic formatting is applied as follows:
* `Italics` text is created by \*surrounding with asterisks\*.
* **Bold** text is created by \*\*surrounding with double asterisks\*\*.
* `Links `_ are created like: \[text\]\(path).
* External links use curly braces: \{text\}\(path).
* Strikethrough text uses tildes: ~~deleted text~~.
Special Blocks
~~~~~~~~~~~~~~
Headings begin with ``#`` characters. One is a ``
``, two is a ``
``, and
so on.
Images use ``![alt text](link/to/image)`` notation.
Videos use ``!(link/to/video)`` notation.
YouTube embeds use ``!{youtube_id}`` notation.
Code can be embedded in ` characters.
You can provide a lookup dictionary to substitute words for paths when rendered.
For example the block ``![alt text](seaside-2)`` when rendered with
``{"seaside-2": "path/to/image"}`` will point in the right place.
Group blocks
~~~~~~~~~~~~
Bullet pointed lists (``-``) and numbered lists will be detected automatically.
Security
~~~~~~~~
Any HTML tags in the markdown will be escaped, preventing (among other things)
the arbitrary injection of JavaScript via submitted markdown.
Example
~~~~~~~
.. code-block:: html
# An example document
This is the *first* paragraph.
This is the **second** paragraph.
This is the ~~second~~ third paragraph.
## Some Links
Here is [a link](https://example.com/).
[This whole paragraph is a link.](https://example2.com/)
### Special Example...
{This link}(https://example3.com/) opens in a new tab.
You [can](https://example.com/) have {multiple}(https://example3.com/) links!
## Media
![Image here!](/images/logo.png)
!(/videos/vid.mp4)
!{zhbnwPAlKxs}
### Inline Media
\!As a side note, incorporating !{blocks} in paragraphs has no
effect. See - !(/videos/vid.mp4).
## Escaping
You can escape characters like \*this\* and \[this](see!).
...becomes...
.. code-block:: html