[build-system]
requires = [
    "hatchling>=0.21.1",
]
build-backend = "hatchling.build"

[project]
name = "pymdown-extensions"
description = "Extension pack for Python Markdown."
readme = "README.md"
license = "MIT"
requires-python = ">=3.9"
authors = [
    { name = "Isaac Muse", email = "Isaac.Muse@gmail.com" },
]
keywords = [
    "extensions",
    "markdown",
]
dynamic = [
    "classifiers",
    "version",
]

dependencies = [
    "Markdown>=3.6",
    "pyyaml"
]

[project.urls]
Homepage = "https://github.com/facelessuser/pymdown-extensions"

[tool.hatch.version]
source = "code"
path = "pymdownx/__meta__.py"

[tool.hatch.metadata]
allow-direct-references = true

[project.optional-dependencies]
extra = [
    "Pygments>=2.19.1"
]

[tool.hatch.build.targets.sdist]
include = [
    "/docs/src/markdown/**/*.md",
    "/docs/src/markdown/**/*.gif",
    "/docs/src/markdown/**/*.png",
    "/docs/src/markdown/dictionary/*.txt",
    "/docs/theme/**/*.css",
    "/docs/theme/**/*.js",
    "/docs/theme/**/*.html",
    "/docs/theme/**/*.css.map",
    "/docs/theme/**/*.js.map",
    "/requirements/*.txt",
    "/pymdownx/**/*.py",
    "/tests/**/*.txt",
    "/tests/**/*.py",
    "/tests/**/*.html",
    "/tests/**/*.yml",
    "/tests/**/*.css",
    "/tests/**/*.png",
    "/tools/__init__.py",
    "/tools/pymdownx_md_render.py",
    "/.pyspelling.yml",
    "/.coveragerc",
    "/mkdocs.yml",
    "/run_tests.py",
]

[tool.hatch.build.targets.wheel]
include = [
    "/pymdownx",
]

[tool.hatch.metadata.hooks.custom]

[tool.mypy]
files = [
    "pymdownx/blocks/block.py"
]
strict = true
show_error_codes = true

[[tool.mypy.overrides]]
module = [
    "pymdownx.superfences"
]
ignore_errors = true

[tool.ruff]
line-length = 120

extend-exclude = [
    "build/*",
    ".tox/*",
    "site/*",
    "tools/tags/*",
    "node_modules/*",
    "*_db.py",
    "dist/*"
]

lint.select = [
    "A",    # flake8-builtins
    "B",    # flake8-bugbear
    "D",    # pydocstyle
    "C4",   # flake8-comprehensions
    "N",    # pep8-naming
    "E",    # pycodestyle
    "F",    # pyflakes
    "PGH",  # pygrep-hooks
    "RUF",  # ruff
    # "UP",   # pyupgrade
    "W",    # pycodestyle
    "YTT",  # flake8-2020,
    "PERF"  # Perflint
]

lint.ignore = [
    "E741",
    "D202",
    "D401",
    "D212",
    "D203",
    "N802",
    "N801",
    "N803",
    "N806",
    "N813",
    "N818",
    "RUF012",
    "RUF005"
]

[tool.tox]
legacy_tox_ini = """
    [tox]
    isolated_build = true
    envlist =
        {py39,py310,py311,py312,py313,py314}, lint, documents

    [testenv]
    passenv = LANG
    deps=
        .[extra]
        -r requirements/test.txt
    commands=
        "{envpython}" -m mypy
        {envbindir}/py.test --cov pymdownx --cov-append {toxinidir}
        {envbindir}/coverage html -d {envtmpdir}/coverage
        {envbindir}/coverage xml
        {envbindir}/coverage report --show-missing

    [testenv:documents]
    deps=
        -r requirements/docs.txt
        .[extra]
    commands=
        {envpython} -m pip install .
        {envpython} -m zensical build -f zensical.yml --clean
        {envpython} -m pyspelling -j 8

    [testenv:lint]
    deps=
        -r requirements/lint.txt
    commands=
        {envbindir}/ruff check {toxinidir}

    [flake8]
    exclude=build/*,.tox/*,.c9/*,site/*,tools/tags/*,node_modules/*,*_db.py,dist/*
    max-line-length=120
    ignore=D202,N802,D203,D401,W504,N813,E741,N818

    [pytest]
    addopts=--ignore=tools --ignore=node_modules
"""
