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