Python library: Python-Markdown

👷🏼‍♂️ WORK IN PROGRESS 👷🏼‍♂️

26 Mar 2023

I have used this library mainly for writing notes in Markdown for this site.

See Building a static site with Pelican


Included in my Pelican configuration file:

    "extension_configs": {
        # Needed for code syntax highlighting
        "markdown.extensions.codehilite": {"css_class": "highlight"},
        "markdown.extensions.extra": {},
        "markdown.extensions.meta": {},
        # To add admonitions
        ## to add divs and classes with !!! type syntax. 
        ## see
        "markdown.extensions.admonition": {},  
        # This is for enabling the TOC generation
        "markdown.extensions.toc": {"title": "Table of Contents"},
    "output_format": "html5",

All extensions possible:

Extension Entry Point Dot Notation
Extra extra markdown.extensions.extra
Abbreviations abbr markdown.extensions.abbr
Attribute Lists attr_list markdown.extensions.attr_list
Definition Lists def_list markdown.extensions.def_list
Fenced Code Blocks fenced_code markdown.extensions.fenced_code
Footnotes footnotes markdown.extensions.footnotes
Markdown in HTML md_in_html markdown.extensions.md_in_html
Tables tables markdown.extensions.tables
Admonition admonition markdown.extensions.admonition
CodeHilite codehilite markdown.extensions.codehilite
Legacy Attributes legacy_attrs markdown.extensions.legacy_attrs
Legacy Emphasis legacy_em markdown.extensions.legacy_em
Meta-Data meta markdown.extensions.meta
New Line to Break nl2br markdown.extensions.nl2br
Sane Lists sane_lists markdown.extensions.sane_lists
SmartyPants smarty markdown.extensions.smarty
Table of Contents toc markdown.extensions.toc
WikiLinks wikilinks markdown.extensions.wikilinks



This is for adding divs and classes with !!! type syntax.

New-Line-to-Break Extension

The New-Line-to-Break (nl2br) Extension will cause newlines to be treated as hard breaks; like StackOverflow and GitHub flavored Markdown do.


The SmartyPants extension converts ASCII dashes, quotes and ellipses to their HTML entity equivalents.

Sane Lists

The Sane Lists extension alters the behavior of the Markdown List syntax to be less surprising.

Table of Contents

The WikiLinks extension adds support for WikiLinks. Specifically, any [[bracketed]] word is converted to a link.

Extension configuration enables to construct a link from the text of the link.

So I think the idea is that you can link straight to the page that has this bracketed string as page URL (spaces converted to underscores).