/mkdocs-iframe

MkDocs plugin to integrate HTML reports into your site

Primary LanguageHTMLISC LicenseISC

MkDocs Iframe Plugin

ci documentation pypi version

MkDocs plugin to integrate HTML reports into your site. This is a modified version of mkdocs-coverage.

Installation

With pip:

pip install mkdocs-iframe

With pipx:

python -m pip install --user pipx
pipx install mkdocs-iframe

Usage

You first need generate your html test reports. For example, using pytest-cov and pytest-html:

pytest --cov --html=htmltest/index.html tests
coverage html

will generate two report directories htmlcov and htmltest.

Now update your MkDocs config:

# mkdocs.yml

nav:
  - Coverage report: cov.md  # Needs to match page from below
  - Test report: test.md  # Needs to match page from below

plugins:
  - iframe:
      reports:
        - name: cov
          path: htmlcov  # default f"html{name}"
          root: index.html  # default
          page: cov.md  # f"{name}.md"
        - name: test
          path: htmltest  # default f"html{name}"
          root: index.html  # default
          page: test.md  # f"{name}.md"

Give the default settings, you could also use the following, simpler config:

# mkdocs.yml

nav:
  - Coverage report: cov.md
  - Test report: test.md

plugins:
  - iframe:
      reports:
        - cov
        - test

Now serve your docs and go to http://localhost:8000/cov/ or http://localhost:8000/test/ to see your test report.

coverage index test index