• Stars
    star
    342
  • Rank 123,697 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A markdown parser with high extensibility.

𝓜𝓪𝓻𝓴𝓸

A markdown parser with high extensibility.

PyPI PyPI - Python Version Documentation Status CommonMark Spec

Build Status codecov Codacy Badge

Marko is a pure Python markdown parser that adheres to the specifications of CommonMark's spec v0.30. It has been designed with high extensibility in mind, as detailed in the Extensions section.

Marko requires Python 3.7 or higher.

Why Marko

Of all the Python markdown parsers available, a common issue is the difficulty for users to add their own features. Additionally, both Python-Markdown and mistune do not comply with CommonMark specifications. This has prompted me to develop a new markdown parser.

Marko's compliance with the complex CommonMark specification can impact its performance. However, using a parser that does not adhere to this spec may result in unexpected rendering outcomes. According to benchmark results, Marko is three times slower than Python-Markdown but slightly faster than Commonmark-py and significantly slower than mistune. If prioritizing performance over spec compliance is crucial for you, it would be best to opt for another parser.

Use Marko

The installation is very simple:

$ pip install marko

And to use it:

import marko

print(marko.convert(text))

Marko also provides a simple CLI, for example, to render a document and output to a html file:

$ cat my_article.md | marko > my_article.html

Extensions

It is super easy to use an extension:

from marko import Markdown
from marko.ext.footnote import make_extension
# Add footnote extension
markdown = Markdown(extensions=[make_extension()])
# Or you can just:
markdown = Markdown(extensions=['footnote'])
# Alternatively you can register an extension later
markdown.use(make_extension())

An example of using an extension with the command-line version of Marko:

$ cat this_has_footnote.txt | marko -e footnote > hi_world.html

Marko is shipped with 4 extensions: 'footnote', 'toc' 'pangu', 'codehilite'. They are not included in CommonMark's spec but are common in other markdown parsers.

Marko also provides a Github flavored markdown parser which can be found at marko.ext.gfm.gfm.

Please refer to Extend Marko about how to write your own extension.

License

Marko is released under MIT License

Change Log

More Repositories

1

legit

Git for Humans, Inspired by GitHub for Mac™.
Python
5,702
star
2

tetos

A unified interface for multiple Text-to-Speech (TTS) providers.
Python
221
star
3

python-cfonts

Sexy fonts for the console
Python
192
star
4

Flog

A Simple Blog Powered by Flask
Vue
191
star
5

unearth

A utility to fetch and download python packages
Python
139
star
6

flask-crontab

Simple Flask scheduled tasks without extra daemons
Python
100
star
7

monas

Python monorepo made easy
Python
77
star
8

wordle-tui

Play WORDLE game in your terminal.
Python
61
star
9

pipfile-requirements

A CLI tool to covert Pipfile/Pipfile.lock to requirments.txt
Python
50
star
10

flask-vue-todo

A todo app with Vue and backed by Flask
Python
48
star
11

pdm-packer

A PDM plugin that packs your packages into a zipapp
Python
46
star
12

onepm

Picks the right package manager for you
Python
44
star
13

picguessr

Python
41
star
14

findpython

A utility to find python versions on your system
Python
36
star
15

fix-future-annotations

A CLI and pre-commit hook to fix future annotations
Python
35
star
16

oven

TypeScript
27
star
17

resume

Personal resume with a handwritten SSG
Python
24
star
18

pdm-vscode

DEPRECATED: A PDM plugin that autogenerates workspace vscode settings for you
Python
23
star
19

pycomplete

A Python library to generate static completion scripts for your CLI app
Python
22
star
20

frostming

My profile, including a chess game
Python
17
star
21

enum-adt

Python
13
star
22

renren-dumps

人人网数据备份器
Python
12
star
23

atoml

Yet another style-preserving TOML library for Python
Python
12
star
24

modul

Python modules with public exports
Python
12
star
25

lektor-tailwind

A Lektor plugin that adds Tailwind CSS to your project seamlessly
Python
11
star
26

flask-webconsole-example

A simple example of web console
HTML
10
star
27

rediswrapper

Pythonic wrapper for Redis Client.
Python
10
star
28

pbs-installer

Python
9
star
29

tokei-pie-cooker

Visualize your code statistics with Pie Chart
Python
8
star
30

scoop-frostming

My personal scoop bucket
PowerShell
7
star
31

pofmt

Your missing PO formatter and linter
Python
7
star
32

myrc

My personal profiles for Win and Mac
Shell
5
star
33

monas-example-repo

Serve as an example of how Monas manage a monorepo
Python
4
star
34

pep665_poc

A POC implementation of PEP 665
Python
4
star
35

pdm-mypyc

A build hook to compile source files with mypyc
Python
4
star
36

hexo-theme-landing-page

Hexo ported theme of Landing Page
CSS
3
star
37

package-manager-demo

Write a package manage from scratch demo repo
Python
3
star
38

transpyler-gpt

A GPT-powered Python transpiler that makes your Python code run on older versions
Python
3
star
39

flask-remote-file

Flask extension to serve remote files via sftp
Python
2
star
40

frostming.github.io

My personal wiki site
Vue
2
star
41

sodoku-solver

Python
2
star
42

wordle-tg

A Telegram Bot that lets you play wordle with other people
Python
2
star
43

daily-trending

Daily trending digest based on people you follow
Python
2
star
44

gorella

Monkey patch regular expression methods to built-in string types
Python
1
star
45

RimeConfig

My Rime Configuration
1
star
46

highlight-lexer-comparison

Lexer comparison of code highlighters
HTML
1
star
47

vscode-mingshe

VSCode language support for MingShe
1
star
48

Codingame

My solutions of https://www.codingame.com
Python
1
star
49

scoop-action

GitHub Action for Scoop buckets
JavaScript
1
star
50

tokei

PyPI package for https://github.com/XAMPPRocky/tokei
Python
1
star
51

pdm-lock-build-deps

Python
1
star
52

pycon-python-pm

PyCon 2019深圳站演讲Slide: Python包管理及Pipenv
CSS
1
star
53

backports.html

Backport of Python 3.4+'s html module
Python
1
star
54

blog_backup

个人博客MD备份
Shell
1
star