1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 commonmark,
6 fetchFromGitHub,
7 flit-core,
8 linkify-it-py,
9 markdown,
10 mdit-py-plugins,
11 mdurl,
12 mistletoe,
13 mistune,
14 myst-parser,
15 panflute,
16 pyyaml,
17 sphinx,
18 sphinx-book-theme,
19 sphinx-copybutton,
20 sphinx-design,
21 stdenv,
22 pytest-regressions,
23 pytestCheckHook,
24 pythonOlder,
25}:
26
27buildPythonPackage rec {
28 pname = "markdown-it-py";
29 version = "3.0.0";
30 format = "pyproject";
31
32 disabled = pythonOlder "3.6";
33
34 src = fetchFromGitHub {
35 owner = "executablebooks";
36 repo = "markdown-it-py";
37 tag = "v${version}";
38 hash = "sha256-cmjLElJA61EysTUFMVY++Kw0pI4wOIXOyCY3To9fpQc=";
39 };
40
41 # fix downstrem usage of markdown-it-py[linkify]
42 pythonRelaxDeps = [ "linkify-it-py" ];
43
44 nativeBuildInputs = [
45 flit-core
46 ];
47
48 propagatedBuildInputs = [ mdurl ];
49
50 nativeCheckInputs = [
51 pytest-regressions
52 pytestCheckHook
53 ]
54 ++ optional-dependencies.linkify;
55
56 # disable and remove benchmark tests
57 preCheck = ''
58 rm -r benchmarking
59 '';
60 doCheck = !stdenv.hostPlatform.isi686;
61
62 pythonImportsCheck = [ "markdown_it" ];
63
64 optional-dependencies = {
65 compare = [
66 commonmark
67 markdown
68 mistletoe
69 mistune
70 panflute
71 ];
72 linkify = [ linkify-it-py ];
73 plugins = [ mdit-py-plugins ];
74 rtd = [
75 attrs
76 myst-parser
77 pyyaml
78 sphinx
79 sphinx-copybutton
80 sphinx-design
81 sphinx-book-theme
82 ];
83 };
84
85 meta = with lib; {
86 description = "Markdown parser in Python";
87 homepage = "https://markdown-it-py.readthedocs.io/";
88 changelog = "https://github.com/executablebooks/markdown-it-py/blob/${src.rev}/CHANGELOG.md";
89 license = licenses.mit;
90 maintainers = with maintainers; [ bhipple ];
91 mainProgram = "markdown-it";
92 };
93}