diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96472ce..74f9e65 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: - id: end-of-file-fixer name: end-of-file-fixer - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.1 + rev: v0.3.4 hooks: - id: ruff args: @@ -79,7 +79,7 @@ repos: name: editorconfig-checker alias: ec - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.9.0 hooks: - id: mypy files: ^src @@ -88,7 +88,7 @@ repos: - platformdirs - wcmatch - repo: https://github.com/tcort/markdown-link-check - rev: v3.11.2 + rev: v3.12.1 hooks: - id: markdown-link-check name: markdown-link-check diff --git a/pyproject.toml b/pyproject.toml index 4f4097a..1466d96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mkdocs-include-markdown-plugin" -version = "6.0.4" +version = "6.0.5" description = "Mkdocs Markdown includer plugin." readme = "README.md" license = "Apache-2.0" diff --git a/src/mkdocs_include_markdown_plugin/event.py b/src/mkdocs_include_markdown_plugin/event.py index 0f2cafe..9b705b3 100644 --- a/src/mkdocs_include_markdown_plugin/event.py +++ b/src/mkdocs_include_markdown_plugin/event.py @@ -444,8 +444,8 @@ def found_include_markdown_tag( # noqa: PLR0912, PLR0915 arguments_string, ) if offset_match: - offset = offset_match[1] - if offset == '': + offset_raw_value = offset_match[1] + if offset_raw_value == '': lineno = lineno_from_content_start( markdown, directive_match_start, @@ -456,15 +456,15 @@ def found_include_markdown_tag( # noqa: PLR0912, PLR0915 f' {os.path.relpath(page_src_path, docs_dir)}:{lineno}', ) try: - offset = int(offset) + offset = int(offset_raw_value) except ValueError: lineno = lineno_from_content_start( markdown, directive_match_start, ) raise PluginError( - f"Invalid 'heading-offset' argument \"{offset}\" in" - " 'include-markdown' directive at " + f"Invalid 'heading-offset' argument \"{offset_raw_value}\"" + " in 'include-markdown' directive at " f'{os.path.relpath(page_src_path, docs_dir)}:{lineno}', ) from None else: @@ -556,7 +556,7 @@ def found_include_markdown_tag( # noqa: PLR0912, PLR0915 ) ) - if offset_match: + if offset: new_text_to_include = process.increase_headings_offset( new_text_to_include, offset=offset + cumulative_heading_offset,