1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 hatchling,
7 pytestCheckHook,
8 markdown,
9 pyyaml,
10 pygments,
11
12 # for passthru.tests
13 mkdocstrings,
14 mkdocs-material,
15 mkdocs-mermaid2-plugin,
16 hydrus,
17}:
18
19let
20 extensions = [
21 "arithmatex"
22 "b64"
23 "betterem"
24 "caret"
25 "critic"
26 "details"
27 "emoji"
28 "escapeall"
29 "extra"
30 "highlight"
31 "inlinehilite"
32 "keys"
33 "magiclink"
34 "mark"
35 "pathconverter"
36 "progressbar"
37 "saneheaders"
38 "smartsymbols"
39 "snippets"
40 "striphtml"
41 "superfences"
42 "tabbed"
43 "tasklist"
44 "tilde"
45 ];
46in
47buildPythonPackage rec {
48 pname = "pymdown-extensions";
49 version = "10.8.1";
50 pyproject = true;
51
52 src = fetchFromGitHub {
53 owner = "facelessuser";
54 repo = "pymdown-extensions";
55 rev = "refs/tags/${version}";
56 hash = "sha256-No0RDBgr40xSOiKXQRLRZnMdV+5i4eM8Jwp7c2Jw/ZY=";
57 };
58
59 patches = [
60 (fetchpatch2 {
61 name = "pymdown-extensions-pygments-compat.patch";
62 url = "https://github.com/facelessuser/pymdown-extensions/commit/f1e2fad862c9738e420b8451dfdfbd9e90e849fc.patch";
63 hash = "sha256-ENYTRXBJ76VPhhab8MdOh+bkcQNRklXT3thvPi+gHIY=";
64 })
65 ];
66
67 build-system = [ hatchling ];
68
69 dependencies = [
70 markdown
71 pygments
72 ];
73
74 nativeCheckInputs = [
75 pytestCheckHook
76 pyyaml
77 ];
78
79 disabledTests = [
80 # test artifact mismatch
81 "test_toc_tokens"
82 ];
83
84 pythonImportsCheck = map (ext: "pymdownx.${ext}") extensions;
85
86 passthru.tests = {
87 inherit
88 mkdocstrings
89 mkdocs-material
90 mkdocs-mermaid2-plugin
91 hydrus
92 ;
93 };
94
95 meta = with lib; {
96 description = "Extensions for Python Markdown";
97 homepage = "https://facelessuser.github.io/pymdown-extensions/";
98 license = with licenses; [
99 mit
100 bsd2
101 ];
102 maintainers = with maintainers; [ cpcloud ];
103 };
104}