Markdown Pypi

Latest version


A renderer for markdown text onto pygame surfaces.

  • Markdown2pdf is a command-line tool to convert markdown file into pdf, was originally designed for myself to create resume.
  • Markdown project descriptions on PyPI! Contribute to di/markdown-description-example development by creating an account on GitHub.

Python implementation of Markdown.

Project description


The package's class parses and renders the contents of a markdown file onto a pygame surface.


1. Instantiation

The class instantiation takes one parameter: the path to the local markdown file.

2. Set the surface, location and area

To display the content of the markdown file on a specific surface in a specific location use the method:

  • surface - the pygame surface which the text is blitted on
  • offset_X - the offset of the text from the surface's left sided border
  • offset_Y- the offset of the text from the surface's top border


  • textAreaWidth - the width of the textarea
  • textAreaHeight - the height of the textarea

If no width/height is supplied, the entire length - starting from the x-/y-coordinateto the right/bottom side of the supplied surface - is used.

3. Display

In the pygame loop, the method display renders the contents of the markdown file onto the surface.In order to allow for scrolling, the display method requires some values from pygame.

Internal workings

Markdown pypi

The class uses a two stage process to render the contents of a markdown file onto a pygame surface.For an overview of the implemented syntactic markdown structures, see Markdown element implementations.

Stage 1: Parsing

The markdown file is parsed to HTML using the package markdown.

Based on the HTML-markers for different types of paragraphs, lists and headers, the text is split into thematic blocks.

Stage 2: Rendering

Each block is rendered based on its specifications. Inline formatting such as bold/strong, italic and codeare taken into account during the rendering process.

  • Text (excluding code-blocks!) is automatically continued in the next line if the supplied width is too small for theparagraph to fit into one line.
  • Code is indented and has a different background color
  • Quotes are indentend, have a different font color and a vertical rectangle in front of the text.
  • Horizontal rule blocks are rendered as a horizontal rectangle along the width of the textarea.


The visuals of the markdown code can be customized with the following function.All functions have default values for the parameters.

Text Format
  • Setting gaps after lines and paragraphs respectively:
  • Setting the font for the normal text and for the code-blocks independently.The module uses pygame.font.SysFont. Possible options are Verdana, Arial, CourierNew, Helvetica etc.The Fonts are given by name as Strings.
  • Setting Font sizes for the three headers, normal text and code-blocks.
  • Setting the background color of the markdown area
  • Setting the general font color of via rgb codes (no default values)
  • Setting the font color of quote-blocks via rgb codes (no default values)
Python markdown library
  • Setting the background color of the code-blocks via rgb codes (no default values)
  • Setting the color of the horizontal line:

Markdown element implementations

The following table gives an overview on which markdown elements are implemented so far and can be displayed correctly.

ElementMarkdown Syntax
Heading# h1
## h2
### h3
BoldLorem **bold text** ipsum
ItalicLorem *italicized text* ipsum
Block of code```
print('Hello World!')
Inline codeLorem `print('Hello World')` ipsum
Unordered List- First item
- Second item
- Third item
Ordered List1. First item
2. Second item
3. Third Item
Blockquote> Lorem ipsum
Horizontal rule---


Warning: Disregarding the following limitations leads to unpredictable outcomes.

A further indented sublist within a list (2nd level items) is not possible at the moment.

Codeblocks are not wrapped. This can lead to code being displayed to the right side of the text area if a code lineis longer than the specified width of the textarea.

Code blocks do not recognize language strings. Code highlighting is hence not implemented.

Overloading the format of a word with bold and italic at the same time is not possible.


Inline formatting is currently only recognized if a whitespace leads and trails the formatting characters.

Incorrect Example:

Correct example:


I welcome pull requests from the community.Please take a look at the TODO file for opportunities to help this project.

Please ensure your PR fulfills the following requirements:

  • English code documentation - including doc-strings for new methods.
  • Pull Requests must fulfill at least one of the following purposes:
    • Bugfixing
    • New functionality (or extending the existing functionalities)
    • Enhancement concerning performance or ease of use.
  • The README is updated accordingly.
  • Your code should pass PEP8. You can check your code's PEP8 compliance here.The exception is the errorcode E501 - line too long - because 79 characters per line is a stupid limit.

Full example

The following code is a full example of how the package can be used.

Release historyRelease notifications RSS feed















Download files

Pip Markdown

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

Files for pygame-markdown, version 1.1.4
Filename, sizeFile typePython versionUpload dateHashes
Filename, size pygame_markdown-1.1.4-py3-none-any.whl (18.8 kB) File type Wheel Python version py3 Upload dateHashes
Filename, size pygame-markdown-1.1.4.tar.gz (17.9 kB) File type Source Python version None Upload dateHashes

Python Markdown2


Hashes for pygame_markdown-1.1.4-py3-none-any.whl

Hashes for pygame_markdown-1.1.4-py3-none-any.whl
AlgorithmHash digest

Pypi Markdown Readme


Python Markdown File

Hashes for pygame-markdown-1.1.4.tar.gz

Install Markdown Pypi

Hashes for pygame-markdown-1.1.4.tar.gz
AlgorithmHash digest