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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.3] 2025-07-30

- Improve `read_from_source()` to support an optional CWD parameter used to
look for the OpenAPI spec. The OpenAPI plugin should supply that CWD relative
to the current markdown file being processed. Markdown customarily uses
paths relative to the document itself. Existing relative paths will not break,
since this will attempt paths relative to both working directories, by
@joewlambeth.

## [1.1.2] 2025-04-22

- Correct the contribs plugin to use the `--follow` option when obtaining
Expand Down
2 changes: 1 addition & 1 deletion neoteroi/mkdocs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.2"
__version__ = "1.1.3"
2 changes: 1 addition & 1 deletion neoteroi/mkdocs/oad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
neoteroi.mkdocs.oad
"""

from pathlib import Path
import re
from pathlib import Path

from mkdocs.config.config_options import Type
from mkdocs.plugins import BasePlugin
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ keywords = [
"documentation",
]
dependencies = [
"essentials-openapi",
"essentials-openapi>=1.2.1",
"mkdocs",
"httpx",
"click",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest
pytest-cov
essentials-openapi[full]>=1.0.2
essentials-openapi[full]>=1.2.1
mkdocs
flake8
black
Expand Down
14 changes: 12 additions & 2 deletions tests/test_mkdocsoad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import textwrap
from unittest.mock import Mock

import pytest

Expand All @@ -7,6 +8,15 @@
from . import get_resource_file_path


def make_mock_page(src_dir="docs", src_path="index.md"):
mock_file = Mock()
mock_file.src_dir = src_dir
mock_file.src_path = src_path
mock_page = Mock()
mock_page.file = mock_file
return mock_page


def test_markdown_without_oad():
handler = MkDocsOpenAPIDocumentationPlugin()

Expand All @@ -20,7 +30,7 @@ def test_markdown_without_oad():
)
)

result = handler.on_page_markdown(example)
result = handler.on_page_markdown(example, make_mock_page())
assert result == example


Expand All @@ -39,7 +49,7 @@ def test_markdown_with_oad(file_name):
)
)

result = handler.on_page_markdown(example)
result = handler.on_page_markdown(example, make_mock_page())

# Note: not testing the full output since this responsibility belongs to the
# essentials-openapi package
Expand Down