diff --git a/CHANGELOG.md b/CHANGELOG.md index 557f070d..0f1c2b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.16.2](https://github.com/mkdocstrings/mkdocstrings/releases/tag/0.16.2) - 2021-10-04 + +[Compare with 0.16.1](https://github.com/mkdocstrings/mkdocstrings/compare/0.16.1...0.16.2) + +### Dependencies +- Support `pymdown-extensions` v9.x ([0831343](https://github.com/mkdocstrings/mkdocstrings/commit/0831343aa8726ed785b17bba1c8d4adf49b46748) by Ofek Lev and [38b22ec](https://github.com/mkdocstrings/mkdocstrings/commit/38b22ec11cded4689115dafc43e16a1e8e40feda) by Timothée Mazzucotelli). + + ## [0.16.1](https://github.com/mkdocstrings/mkdocstrings/releases/tag/0.16.1) - 2021-09-23 [Compare with 0.16.0](https://github.com/mkdocstrings/mkdocstrings/compare/0.16.0...0.16.1) diff --git a/docs/theming.md b/docs/theming.md index 8a1d969c..994d9ba6 100644 --- a/docs/theming.md +++ b/docs/theming.md @@ -1,7 +1,7 @@ # Themes *mkdocstrings* can support multiple MkDocs themes. -It currently supports supports the +It currently supports the *[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)* theme and, partially, the built-in ReadTheDocs theme. diff --git a/pyproject.toml b/pyproject.toml index 4f806842..5e3fa81c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ "MarkupSafe>=1.1,<3.0", "mkdocs~=1.2", "mkdocs-autorefs>=0.1,<0.4", - "pymdown-extensions>=6.3,<9.0", + "pymdown-extensions>=6.3,<10.0", "pytkdocs>=0.2.0,<0.13.0", ] diff --git a/src/mkdocstrings/handlers/rendering.py b/src/mkdocstrings/handlers/rendering.py index e8383cf2..e7ff9802 100644 --- a/src/mkdocstrings/handlers/rendering.py +++ b/src/mkdocstrings/handlers/rendering.py @@ -33,8 +33,27 @@ class Highlighter(Highlight): The underlying implementation is `pymdownx.highlight` regardless. """ + # https://raw.githubusercontent.com/facelessuser/pymdown-extensions/main/docs/src/markdown/extensions/highlight.md _highlight_config_keys = frozenset( - "use_pygments guess_lang css_class pygments_style noclasses linenums language_prefix".split(), + ( + "css_class", + "guess_lang", + "pygments_style", + "noclasses", + "use_pygments", + "linenums", + "linenums_special", + "linenums_style", + "linenums_class", + "extend_pygments_lang", + "language_prefix", + "code_attr_on_pre", + "auto_title", + "auto_title_map", + "line_spans", + "anchor_linenums", + "line_anchors", + ) ) def __init__(self, md: Markdown): diff --git a/tests/test_themes.py b/tests/test_themes.py index c3396ad9..3d6066d1 100644 --- a/tests/test_themes.py +++ b/tests/test_themes.py @@ -14,10 +14,9 @@ ], indirect=["plugin"], ) -@pytest.mark.skipif(sys.version_info < (3, 7), reason="material is not installed on Python 3.6") -def test_render_themes_templates_python(plugin): - """Test rendering of a given theme's templates.""" - modules = { +@pytest.mark.parametrize( + "module", + [ "mkdocstrings.extension", "mkdocstrings.inventory", "mkdocstrings.loggers", @@ -25,9 +24,12 @@ def test_render_themes_templates_python(plugin): "mkdocstrings.handlers.base", "mkdocstrings.handlers.python", "mkdocstrings.handlers.rendering", - } + ], +) +@pytest.mark.skipif(sys.version_info < (3, 7), reason="material is not installed on Python 3.6") +def test_render_themes_templates_python(module, plugin): + """Test rendering of a given theme's templates.""" handler = plugin.handlers.get_handler("python") handler.renderer._update_env(plugin.md, plugin.handlers._config) # noqa: WPS437 - for identifier in modules: - data = handler.collector.collect(identifier, {}) - handler.renderer.render(data, {}) + data = handler.collector.collect(module, {}) + handler.renderer.render(data, {})