-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* set up mkdocs locally (mkdocs.yml and gen_ref_pages.py)
* added index.md, CONTRIBUTING.md, about.md * added the generated folder to gitignore * added logos in the README.md
- Loading branch information
1 parent
c0935d4
commit aed9a4d
Showing
13 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,5 @@ dmypy.json | |
|
||
.DS_Store | ||
|
||
# mkdocs generated folder | ||
docs/generated/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Examples | ||
|
||
This page consists of the 'General example' gallery and a sub-gallery, | ||
'No image output examples'. This sub-gallery is generated from a | ||
sub-directory within the general examples directory. The file structure of | ||
this gallery looks like this: | ||
|
||
``` | ||
examples/ # base 'Gallery of Examples' directory | ||
├── README.md | ||
├── test_example.py | ||
├── test_myClass.py | ||
├── <.py files> | ||
``` | ||
|
||
## General examples | ||
|
||
This gallery consists of introductory examples and examples demonstrating | ||
specific features of Mkdocs-Gallery. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
A short Python script | ||
===================== | ||
This demonstrates an example `.py` file that is not executed when gallery is | ||
generated (see | ||
[Parsing and executing examples via matching patterns](https://sphinx-gallery.github.io/stable/configuration.html#build-pattern)) | ||
but nevertheless gets included as an example. Note that no output is captured as this file is not executed. | ||
""" | ||
|
||
# Code source: Óscar Nájera | ||
# License: BSD 3 clause | ||
|
||
from __future__ import print_function | ||
print([i for i in range(10)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
""" | ||
Example myClass | ||
Local module | ||
============ | ||
This example demonstrates how local modules can be imported. | ||
This module is imported in the example | ||
""" | ||
|
||
N = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Generate the code reference pages and navigation.""" | ||
|
||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
nav = mkdocs_gen_files.Nav() | ||
|
||
for path in sorted(Path("src").rglob("*.py")): | ||
module_path = path.relative_to("src").with_suffix("") | ||
doc_path = path.relative_to("src").with_suffix(".md") | ||
full_doc_path = Path("reference", doc_path) | ||
|
||
parts = tuple(module_path.parts) | ||
if parts[-1] == "__init__": | ||
parts = parts[:-1] | ||
doc_path = doc_path.with_name("index.md") | ||
full_doc_path = full_doc_path.with_name("index.md") | ||
elif parts[-1] == "__main__": | ||
continue | ||
|
||
nav[parts] = doc_path.as_posix() | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
ident = ".".join(parts) | ||
fd.write(f"::: {ident}") | ||
|
||
mkdocs_gen_files.set_edit_path(full_doc_path, path) | ||
|
||
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file: | ||
nav_file.writelines(nav.build_literate_nav()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
site_name: ccn-template | ||
repo_url: https://github.com/flatironinstitute/ccn-template | ||
|
||
theme: | ||
name: 'material' | ||
palette: | ||
primary: 'light blue' | ||
features: | ||
- navigation.tabs | ||
plugins: | ||
- search # make sure the search plugin is still enabled | ||
- mkdocstrings | ||
- gen-files: | ||
scripts: | ||
- docs/gen_ref_pages.py | ||
- literate-nav: | ||
nav_file: docs/SUMMARY.md | ||
- section-index | ||
- gallery: | ||
examples_dirs: docs/examples # path to your example scripts | ||
gallery_dirs: docs/generated/gallery # where to save generated gallery | ||
# # ... (other options) | ||
nav: | ||
- Home: index.md | ||
- Tutorials: generated/gallery | ||
- Contributing: CONTRIBUTING.md | ||
- Code References: reference/ | ||
- About: about.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters