Skip to content

Commit

Permalink
Merge pull request #92 from Louis-Pujol/main
Browse files Browse the repository at this point in the history
Examples folder outside of docs/
  • Loading branch information
smarie committed Mar 15, 2024
2 parents 8a16972 + f7577c2 commit b1125b7
Show file tree
Hide file tree
Showing 26 changed files with 17 additions and 12 deletions.
10 changes: 7 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 0.10.1

- `examples` folder is not required to be in a subfolder of `docs` anymore. Fixes [#54](https://github.com/smarie/mkdocs-gallery/issues/54). PR [#92](https://github.com/smarie/mkdocs-gallery/pull/92) by [Louis-Pujol](https://github.com/Louis-Pujol).

### 0.10.0 - Support for asynchronous code

- Gallery scripts now support top-level asynchronous code. PR [#90](https://github.com/smarie/mkdocs-gallery/pull/90) by [pmeier](https://github.com/pmeier)
Expand All @@ -12,7 +16,7 @@

- Mayavi can now be used in gallery examples just as in `sphinx-gallery`. PR [#69](https://github.com/smarie/mkdocs-gallery/pull/69) by [GenevieveBuckley](https://github.com/GenevieveBuckley)
- Fixed for `README.md` that contains `html` comments. Fixes [#85](https://github.com/smarie/mkdocs-gallery/issues/85). PR [#86](https://github.com/smarie/mkdocs-gallery/pull/86) by [AntoineD](https://github.com/AntoineD).

### 0.7.10 - `sys.path` is not reset between code blocks

- `sys.path` modifications now persist across blocks of an example. `sys.path` is still reset after each example. PR [#82](https://github.com/smarie/mkdocs-gallery/pull/82) by [Louis-Pujol](https://github.com/Louis-Pujol).
Expand Down Expand Up @@ -46,7 +50,7 @@

- Python scripts are now correctly skipped in case of identical md5 hash. Fixes [#29](https://github.com/smarie/mkdocs-gallery/issues/29). PR [#27](https://github.com/smarie/mkdocs-gallery/pull/27) by [mchaaler](https://github.com/mchaaler).
- Fixed error when `edit_url` is set to empty to [disable the "edit page" feature](https://www.mkdocs.org/user-guide/configuration/#edit_uri). Fixes [#32](https://github.com/smarie/mkdocs-gallery/issues/32). PR [#27](https://github.com/smarie/mkdocs-gallery/pull/27) by [mchaaler](https://github.com/mchaaler).

This release was yanked because of [#34](https://github.com/smarie/mkdocs-gallery/issues/34).

### 0.7.3 - Bugfix
Expand Down Expand Up @@ -80,7 +84,7 @@ This release was yanked because of [#34](https://github.com/smarie/mkdocs-galler

Initial release with:

- Basic features:
- Basic features:
- pages generation with markdown-based gallery examples. Currently only the `material` theme renders correctly
- download buttons (both on each example and on the summaries) and page header link to the downloads section
- subgalleries
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins:
- gallery:
conf_script: docs/gallery_conf.py # Base conf. Possibly modified by items below
examples_dirs:
- docs/examples # path to your example scripts, relative to mkdocs.yml
- examples # path to your example scripts, relative to mkdocs.yml
- docs/tutorials
gallery_dirs:
- docs/generated/gallery # where to save gallery generated output. Note that you may or may not include them in
Expand All @@ -39,8 +39,8 @@ plugins:
# specify the order of examples to be according to filename
within_subsection_order: FileNameSortKey
expected_failing_examples:
- docs/examples/no_output/plot_raise.py
- docs/examples/no_output/plot_syntaxerror.py
- examples/no_output/plot_raise.py
- examples/no_output/plot_syntaxerror.py

# min_reported_time: min_reported_time, in conf file
binder:
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def tests(session: PowerSession, coverage, pkg_specs):
with open("mkdocs-no-mayavi.yml", "w") as f:
for line in mkdocs_config:
if line == " expected_failing_examples:\n":
line = line + " - docs/examples/plot_10_mayavi.py\n"
line = line + " - examples/plot_10_mayavi.py\n"
f.write(line)

# install CI-only dependencies
Expand Down
3 changes: 2 additions & 1 deletion src/mkdocs_gallery/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
The mkdocs plugin entry point
"""
import os
from os.path import relpath
import re
from pathlib import Path
from typing import Any, Dict, List, Union
Expand Down Expand Up @@ -342,7 +343,7 @@ def _get_dirs_relative_to(self, dir_or_list_of_dirs: Union[str, List[str]], rel_
dir_or_list_of_dirs = [dir_or_list_of_dirs]

# Get them relative to the mkdocs source dir
return [Path(e).relative_to(rel_to_dir).as_posix() for e in dir_or_list_of_dirs]
return [Path(relpath(Path(e), start=Path(rel_to_dir))).as_posix() for e in dir_or_list_of_dirs]

# def on_nav(self, nav, config, files):
# # Nav is already modded in on_pre_build, do not change it
Expand Down
6 changes: 3 additions & 3 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_full_conf(basic_mkdocs_config, monkeypatch):
full_config = yaml_load("""
conf_script: docs/gallery_conf.py
examples_dirs:
- docs/examples
- examples
- docs/tutorials
# TODO mayavi_examples
gallery_dirs:
Expand All @@ -83,8 +83,8 @@ def test_full_conf(basic_mkdocs_config, monkeypatch):
compress_images: ['images', 'thumbnails']
within_subsection_order: FileNameSortKey
expected_failing_examples:
- docs/examples/no_output/plot_raise.py
- docs/examples/no_output/plot_syntaxerror.py
- examples/no_output/plot_raise.py
- examples/no_output/plot_syntaxerror.py
# min_reported_time: min_reported_time, in conf file
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gen_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

TESTS_ROOT = Path(__file__).parent
DOCS_ROOT = TESTS_ROOT / "../docs"
EXAMPLES_DIR = DOCS_ROOT / "examples"
EXAMPLES_DIR = TESTS_ROOT / "../examples"
TUTORIALS_DIR = DOCS_ROOT / "tutorials"


Expand Down

0 comments on commit b1125b7

Please sign in to comment.