Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkgs/by-name/md/md2pdf/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
python3Packages,
}:

python3Packages.toPythonApplication (
python3Packages.md2pdf.overridePythonAttrs (oldAttrs: {
dependencies = oldAttrs.dependencies ++ oldAttrs.optional-dependencies.cli;
})
)
31 changes: 26 additions & 5 deletions pkgs/development/python-modules/md2pdf/default.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
buildPythonPackage,
click,
fetchFromGitHub,
hatchling,
jinja2,
lib,
markdown,
pygments,
pymdown-extensions,
pypdf,
pytest-cov-stub,
pytestCheckHook,
python-frontmatter,
typer,
watchfiles,
weasyprint,
}:

buildPythonPackage rec {
pname = "md2pdf";
version = "2.1.0";
version = "3.1.0";
pyproject = true;

src = fetchFromGitHub {
owner = "jmaupetit";
repo = "md2pdf";
tag = "v${version}";
hash = "sha256-oVWUoWIS9GmkNPbJg90diT0jEgOULySSNxNdg95T2Vs=";
hash = "sha256-ksccl9K0o0mZleyLe1K1ob78W2MKZksTFtu6/dZUWeg=";
};

build-system = [ hatchling ];

dependencies = [
click
jinja2
markdown
pygments
Expand All @@ -38,17 +39,37 @@ buildPythonPackage rec {
weasyprint
];

optional-dependencies = {
cli = [
typer
watchfiles
];
latex = [
# FIXME package markdown-latex
];
};

pythonImportsCheck = [ "md2pdf" ];

nativeCheckInputs = [
pypdf
pytest-cov-stub
pytestCheckHook
];
]
++ lib.concatAttrValues optional-dependencies;

preCheck = ''
export PATH="$out/bin:$PATH"
'';

disabledTests = [
# AssertionError caused by
# glyph rendered for Unicode string unsupported by fonts: "👋" (U+1F44B)
"test_generate_pdf_with_jinja_context_input"
"test_generate_pdf_with_jinja_frontmatter_and_context_input"
"test_generate_pdf_with_jinja_frontmatter_input"
];

meta = {
changelog = "https://github.com/jmaupetit/md2pdf/blob/${src.tag}/CHANGELOG.md";
description = "Markdown to PDF conversion tool";
Expand Down
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2820,8 +2820,6 @@ with pkgs;

md2gemini = with python3.pkgs; toPythonApplication md2gemini;

md2pdf = with python3Packages; toPythonApplication md2pdf;

mdcat = callPackage ../tools/text/mdcat {
inherit (python3Packages) ansi2html;
};
Expand Down
Loading