diff --git a/pyproject.toml b/pyproject.toml index 4c61b68..f11d546 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,10 @@ [build-system] -requires = ["hatchling >=1.11.1,<2.0.0", "hatch-vcs >=0.3.0,<0.4"] +requires = ["hatchling >=1.11.1,<2.0.0", "hatch-vcs >=0.3.0,<0.4", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [project] name = "labelle" description = "Open-source label printing software" -readme = "README.md" url = "https://github.com/labelle-org/labelle" authors = [{name = "Sebastian J. Bronner", email = "waschtl@sbronner.com"}] maintainers = [ @@ -35,7 +34,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Topic :: Printing", ] -dynamic = ["version"] +dynamic = ["version", "readme"] requires-python = ">=3.8,<4" [project.optional-dependencies] @@ -66,6 +65,30 @@ version-file = "src/labelle/_version.py" [tool.hatch.build.targets.wheel] packages = ["src/labelle"] +# +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/markdown" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] +path = "README.md" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +# Image links should go to the raw content on GitHub +# +pattern = '\[(.*?)\]\(((?!https?://)\S+\.(png|jpe?g|svg|gif))\)' +replacement = '[\1](https://raw.githubusercontent.com/labelle-org/labelle/main/\g<2>)' + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +# Handle also HTML image tags +pattern = '''(]*\bsrc=)(['"])((?!https?://)[^'"]+)(['"][^>]*>)''' +replacement = '