Skip to content

Commit

Permalink
Merge pull request #218 from daizutabi/217-doctests-are-rendered-as-r…
Browse files Browse the repository at this point in the history
…aw-markdown

Doctests are rendered as raw markdown
  • Loading branch information
daizutabi authored Feb 25, 2025
2 parents 94f4085 + ce8ec4d commit 4a02842
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"astdoc>=1.0.0",
"astdoc>=1.1.1",
"jinja2",
"mkdocs-material",
"mkdocs>=1.6.0",
Expand Down
2 changes: 2 additions & 0 deletions src/mkapi/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import TYPE_CHECKING

from astdoc.markdown import set_example_class
from astdoc.utils import cache_clear, get_module_path, is_package
from mkdocs.plugins import BasePlugin, get_plugin_logger
from mkdocs.structure.files import File, InclusionLevel
Expand Down Expand Up @@ -38,6 +39,7 @@ def __init__(self) -> None:
self.pages = {}
self.progress = None
self.task_id = None
set_example_class("mkapi-example-input", "mkapi-example-output")

def on_config(self, config: MkDocsConfig, **kwargs) -> MkDocsConfig:
cache_clear()
Expand Down
3 changes: 2 additions & 1 deletion tests/parser/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def doc_func():


def test_parse_doc_function_text(doc_func: Doc):
assert doc_func.text == "Docstring [`D`][__mkapi__.astdoc.node.Definition]."
expected = "Docstring [`D`][__mkapi__.astdoc.node.Definition]."
assert doc_func.text.rstrip() == expected


def test_parse_doc_function_args(doc_func: Doc):
Expand Down

0 comments on commit 4a02842

Please sign in to comment.