mkdocs-mknodes 0.3.3__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.github/README.md +2 -2
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/PKG-INFO +4 -3
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/README.md +1 -1
- mkdocs_mknodes-0.3.5/duties.py +64 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs.yml +1 -1
- mkdocs_mknodes-0.3.5/mkdocs_mknodes/__init__.py +1 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/backends/buildbackend.py +14 -14
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/backends/markdownbackend.py +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/backends/mkdocsbackend.py +11 -22
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/buildcollector.py +9 -9
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/cli/__init__.py +4 -4
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/cli_section.py +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/get_started_section.py +3 -3
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/github_index.py +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/use_cases_section.py +4 -4
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/mkdocsconfig.py +2 -2
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/plugin/__init__.py +0 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/plugin/pluginconfig.py +3 -2
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/github_index.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_case_by_config.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_case_default_website.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_case_subwebsites.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_cases_index.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/why_should_i_use_mknodes.jinja +1 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/pyproject.toml +2 -1
- mkdocs_mknodes-0.3.3/Makefile +0 -38
- mkdocs_mknodes-0.3.3/mkdocs_mknodes/__init__.py +0 -1
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.editorconfig +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.github/workflows/build.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.github/workflows/documentation.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.gitignore +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/.pre-commit-config.yaml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/LICENSE +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/configs/mkdocs_mkdocs.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/configs/mkdocs_mkdocstrings.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/configs/mkdocs_multipage.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/configs/mkdocs_shared.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/docs/assets/cli.gif +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/backends/__init__.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/buildcontext.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/cli/richstate.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/commands/__init__.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/commands/build_page.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/commands/serve.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/__init__.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/multi_project.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/manual/root.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/paths.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/plugin/mkdocsbuilder.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/plugin/mkdocshelpers.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/plugin/rewriteloader.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/py.typed +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/build_process.jinja +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/cli_index.jinja +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/index.jinja +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/mkdocs_basic.yml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/plugin_configuration.jinja +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/timeline_data.toml +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes.sublime-project +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/overrides/_dummy.txt +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/overrides/partials/actions.html +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/tests/__init__.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/tests/conftest.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/tests/data/objects.inv +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/tests/test_build.py +0 -0
- {mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/tests/test_cli.py +0 -0
|
@@ -45,7 +45,7 @@ def create_github_index_md() -> mk.MkPage:
|
|
|
45
45
|
[](https://github.com/psf/black)
|
|
46
46
|
[](https://pyup.io/repos/github/phil65/mkdocs_mknodes/)
|
|
47
47
|
|
|
48
|
-
[Read the completely coded documentation!](https://phil65.github.io/
|
|
48
|
+
[Read the completely coded documentation!](https://phil65.github.io/mkdocs-mknodes/)
|
|
49
49
|
|
|
50
50
|
## How to install
|
|
51
51
|
|
|
@@ -137,7 +137,7 @@ graph LR
|
|
|
137
137
|
2257954976128["mkinclude.MkInclude"]
|
|
138
138
|
2257952115568["mkcallable.MkCallable"]
|
|
139
139
|
2257952108736["mkcommandoutput.MkCommandOutput"]
|
|
140
|
-
2257952117520["mkjinjatemplate.
|
|
140
|
+
2257952117520["mkjinjatemplate.MkTemplate"]
|
|
141
141
|
2257944740368 --> 2257944738416
|
|
142
142
|
2257944740368 --> 2257955065920
|
|
143
143
|
2257955065920 --> 2257991175136
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mkdocs-mknodes
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Don't write docs. Code them.
|
|
5
|
-
Project-URL: Documentation, https://phil65.github.io/
|
|
5
|
+
Project-URL: Documentation, https://phil65.github.io/mkdocs-mknodes/
|
|
6
6
|
Project-URL: Source, https://github.com/phil65/mkdocs_mknodes
|
|
7
7
|
Project-URL: Gitter, https://app.gitter.im/#/room/#mknodes:gitter.im
|
|
8
8
|
Author-email: Philipp Temminghoff <philipptemminghoff@gmail.com>
|
|
@@ -25,6 +25,7 @@ Classifier: Topic :: Software Development :: User Interfaces
|
|
|
25
25
|
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
26
26
|
Requires-Python: >=3.11
|
|
27
27
|
Requires-Dist: jinja2
|
|
28
|
+
Requires-Dist: jinjarope
|
|
28
29
|
Requires-Dist: mkdocs>=1.5
|
|
29
30
|
Requires-Dist: mknodes
|
|
30
31
|
Requires-Dist: rich
|
|
@@ -79,7 +80,7 @@ def create_github_index_md() -> mk.MkPage:
|
|
|
79
80
|
[](https://github.com/psf/black)
|
|
80
81
|
[](https://pyup.io/repos/github/phil65/mkdocs_mknodes/)
|
|
81
82
|
|
|
82
|
-
[Read the completely coded documentation!](https://phil65.github.io/
|
|
83
|
+
[Read the completely coded documentation!](https://phil65.github.io/mkdocs-mknodes/)
|
|
83
84
|
|
|
84
85
|
## How to install
|
|
85
86
|
|
|
@@ -45,7 +45,7 @@ def create_github_index_md() -> mk.MkPage:
|
|
|
45
45
|
[](https://github.com/psf/black)
|
|
46
46
|
[](https://pyup.io/repos/github/phil65/mkdocs_mknodes/)
|
|
47
47
|
|
|
48
|
-
[Read the completely coded documentation!](https://phil65.github.io/
|
|
48
|
+
[Read the completely coded documentation!](https://phil65.github.io/mkdocs-mknodes/)
|
|
49
49
|
|
|
50
50
|
## How to install
|
|
51
51
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
from duty import duty
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
ENV_PREFIX = "hatch run "
|
|
9
|
+
|
|
10
|
+
PARAMS = ["--disable-pip-version-check", "--outdated", "--format=json"]
|
|
11
|
+
UPDATE_CMD = f"""{ENV_PREFIX}python -m pip list {" ".join(PARAMS)}"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@duty(capture=False)
|
|
15
|
+
def build(ctx):
|
|
16
|
+
"""Build a MkNodes page."""
|
|
17
|
+
ctx.run(f"{ENV_PREFIX}mknodes build")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@duty(capture=False)
|
|
21
|
+
def serve(ctx, args: str | None = None):
|
|
22
|
+
"""Serve a MkNodes page."""
|
|
23
|
+
args = f" {args}" if args else ""
|
|
24
|
+
ctx.run(f"{ENV_PREFIX}mknodes serve{args}")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@duty(capture=False)
|
|
28
|
+
def test(ctx, args: str | None = None):
|
|
29
|
+
"""Serve a MkNodes page."""
|
|
30
|
+
args = f" {args}" if args else ""
|
|
31
|
+
ctx.run(f"{ENV_PREFIX}pytest{args}")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@duty(capture=False)
|
|
35
|
+
def clean(ctx):
|
|
36
|
+
"""Clean all files from the Git directory except checked-in files."""
|
|
37
|
+
ctx.run("git clean -dfX")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@duty
|
|
41
|
+
def update(ctx):
|
|
42
|
+
"""Update all environment packages using pip directly."""
|
|
43
|
+
requirements = ctx.run(UPDATE_CMD)
|
|
44
|
+
requirements = "\n".join(requirements.split("\n")[1:])
|
|
45
|
+
packages = [x["name"] for x in json.loads(requirements)]
|
|
46
|
+
if packages:
|
|
47
|
+
package_str = " ".join(packages)
|
|
48
|
+
print(f"Packages to update: {package_str}")
|
|
49
|
+
ctx.run(f"{ENV_PREFIX}python -m pip install -U {package_str}", capture=False)
|
|
50
|
+
else:
|
|
51
|
+
print("No packages to update!")
|
|
52
|
+
ctx.run(f"{ENV_PREFIX}python -m pip install -e .", capture=False)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@duty(capture=False)
|
|
56
|
+
def lint(ctx):
|
|
57
|
+
"""Update all environment packages using pip directly."""
|
|
58
|
+
ctx.run(f"{ENV_PREFIX}lint")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@duty(capture=False)
|
|
62
|
+
def lint_check(ctx):
|
|
63
|
+
"""Update all environment packages using pip directly."""
|
|
64
|
+
ctx.run(f"{ENV_PREFIX}lint-check")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
site_name: MkNodes (MkDocs plugin)
|
|
2
2
|
site_description: "Don´t write docs. Code them."
|
|
3
3
|
repo_url: "https://github.com/phil65/mkdocs_mknodes/"
|
|
4
|
-
site_url: https://phil65.github.io/
|
|
4
|
+
site_url: https://phil65.github.io/mkdocs-mknodes/
|
|
5
5
|
site_author: Philipp Temminghoff
|
|
6
6
|
copyright: Copyright © 2023 Philipp Temminghoff
|
|
7
7
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.5"
|
|
@@ -14,35 +14,35 @@ class BuildBackend:
|
|
|
14
14
|
templates: list,
|
|
15
15
|
):
|
|
16
16
|
self.collect_extensions(reqs.markdown_extensions)
|
|
17
|
-
self.
|
|
18
|
-
self.
|
|
19
|
-
self.
|
|
20
|
-
self.
|
|
21
|
-
self.
|
|
22
|
-
self.
|
|
23
|
-
|
|
24
|
-
def
|
|
17
|
+
self.write_js_links(reqs.js_links)
|
|
18
|
+
self.write_js_files(reqs.js_files)
|
|
19
|
+
self.write_css(reqs.css)
|
|
20
|
+
self.write_templates(templates)
|
|
21
|
+
self.write_files(files)
|
|
22
|
+
self.write_assets(reqs.assets)
|
|
23
|
+
|
|
24
|
+
def write_files(self, files):
|
|
25
25
|
pass
|
|
26
26
|
|
|
27
|
-
def
|
|
27
|
+
def write_js_links(self, js_links):
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def write_js_files(self, js_files):
|
|
31
31
|
pass
|
|
32
32
|
|
|
33
|
-
def
|
|
33
|
+
def write_css(self, css):
|
|
34
34
|
pass
|
|
35
35
|
|
|
36
|
-
# def
|
|
36
|
+
# def write_css_links(self, css):
|
|
37
37
|
# pass
|
|
38
38
|
|
|
39
39
|
def collect_extensions(self, extensions):
|
|
40
40
|
pass
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def write_templates(self, templates):
|
|
43
43
|
pass
|
|
44
44
|
|
|
45
|
-
def
|
|
45
|
+
def write_assets(self, assets):
|
|
46
46
|
pass
|
|
47
47
|
|
|
48
48
|
|
|
@@ -27,7 +27,7 @@ class MarkdownBackend(buildbackend.BuildBackend):
|
|
|
27
27
|
self.directory = upath.UPath(directory or ".")
|
|
28
28
|
self._files: dict[str, str | bytes] = {}
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def write_files(self, files: dict[str, str | bytes]):
|
|
31
31
|
for k, v in files.items():
|
|
32
32
|
logger.debug("%s: Writing file to %r", type(self).__name__, str(k))
|
|
33
33
|
target_path = (self.directory / k).with_suffix(self.extension)
|
|
@@ -66,14 +66,14 @@ class MkDocsBackend(buildbackend.BuildBackend):
|
|
|
66
66
|
files = sorted(self._mk_files.values(), key=mkdocshelpers.file_sorter)
|
|
67
67
|
return files_.Files(files)
|
|
68
68
|
|
|
69
|
-
def
|
|
69
|
+
def write_files(self, files):
|
|
70
70
|
for k, v in files.items():
|
|
71
71
|
if pathlib.Path(k).name == "SUMMARY.md":
|
|
72
72
|
continue
|
|
73
73
|
logger.debug("%s: Writing file to %r", type(self).__name__, str(k))
|
|
74
74
|
self._write_file(k, v)
|
|
75
75
|
|
|
76
|
-
def
|
|
76
|
+
def write_assets(self, assets):
|
|
77
77
|
for asset in assets:
|
|
78
78
|
if asset.target_dir == "docs_dir":
|
|
79
79
|
abs_path = upath.UPath(self._config.docs_dir) / asset.filename
|
|
@@ -84,15 +84,19 @@ class MkDocsBackend(buildbackend.BuildBackend):
|
|
|
84
84
|
abs_path = upath.UPath(self._config.site_dir) / path
|
|
85
85
|
pathhelpers.write_file(asset.content, abs_path)
|
|
86
86
|
|
|
87
|
-
def
|
|
87
|
+
def write_css(self, css_files):
|
|
88
88
|
for css in css_files:
|
|
89
89
|
if isinstance(css, resources.CSSText):
|
|
90
|
-
|
|
90
|
+
path = (pathlib.Path("assets") / css.resolved_filename).as_posix()
|
|
91
|
+
self._config.extra_css.append(path)
|
|
92
|
+
abs_path = upath.UPath(self._config.site_dir) / path
|
|
93
|
+
logger.info("Registering css file %s...", abs_path)
|
|
94
|
+
pathhelpers.write_file(css.content, abs_path)
|
|
91
95
|
else:
|
|
92
96
|
logger.debug("Adding remote CSS file %s", css)
|
|
93
97
|
self._config.extra_css.append(str(css))
|
|
94
98
|
|
|
95
|
-
def
|
|
99
|
+
def write_js_links(self, js_links):
|
|
96
100
|
for file in js_links:
|
|
97
101
|
logger.debug("Adding remote JS file %s", str(file))
|
|
98
102
|
val = config_options.ExtraScriptValue(str(file))
|
|
@@ -101,7 +105,7 @@ class MkDocsBackend(buildbackend.BuildBackend):
|
|
|
101
105
|
val.type = file.typ
|
|
102
106
|
self._config.extra_javascript.append(val)
|
|
103
107
|
|
|
104
|
-
def
|
|
108
|
+
def write_js_files(self, js_files):
|
|
105
109
|
for file in js_files:
|
|
106
110
|
path = (pathlib.Path("assets") / file.resolved_filename).as_posix()
|
|
107
111
|
val = config_options.ExtraScriptValue(str(path))
|
|
@@ -124,7 +128,7 @@ class MkDocsBackend(buildbackend.BuildBackend):
|
|
|
124
128
|
extensions,
|
|
125
129
|
)
|
|
126
130
|
|
|
127
|
-
def
|
|
131
|
+
def write_templates(self, templates):
|
|
128
132
|
if not self._config.theme.custom_dir:
|
|
129
133
|
logger.warning("Cannot write template. No custom_dir set in config.")
|
|
130
134
|
return
|
|
@@ -154,21 +158,6 @@ class MkDocsBackend(buildbackend.BuildBackend):
|
|
|
154
158
|
target_path = new_path
|
|
155
159
|
pathhelpers.write_file(content, target_path or source_path)
|
|
156
160
|
|
|
157
|
-
def add_css_file(self, filename: str | os.PathLike, css: str):
|
|
158
|
-
"""Register a css file.
|
|
159
|
-
|
|
160
|
-
Writes file to build assets folder and registers extra_css in config
|
|
161
|
-
|
|
162
|
-
Arguments:
|
|
163
|
-
filename: Filename to write
|
|
164
|
-
css: file content
|
|
165
|
-
"""
|
|
166
|
-
path = (pathlib.Path("assets") / filename).as_posix()
|
|
167
|
-
self._config.extra_css.append(path)
|
|
168
|
-
abs_path = upath.UPath(self._config.site_dir) / path
|
|
169
|
-
logger.info("Registering css file %s...", abs_path)
|
|
170
|
-
pathhelpers.write_file(css, abs_path)
|
|
171
|
-
|
|
172
161
|
|
|
173
162
|
if __name__ == "__main__":
|
|
174
163
|
backend = MkDocsBackend()
|
|
@@ -38,14 +38,12 @@ def add_page_info(page: mk.MkPage, req: resources.Resources):
|
|
|
38
38
|
details = mk.MkAdmonition(code, title=title, collapsible=True, typ="quote")
|
|
39
39
|
adm += details
|
|
40
40
|
|
|
41
|
-
title = "Resources"
|
|
42
41
|
pretty = mk.MkPrettyPrint(req)
|
|
43
|
-
details = mk.MkAdmonition(pretty, title=
|
|
42
|
+
details = mk.MkAdmonition(pretty, title="Resources", collapsible=True, typ="quote")
|
|
44
43
|
adm += details
|
|
45
44
|
|
|
46
|
-
title = "Metadata"
|
|
47
45
|
code = mk.MkCode(str(page.resolved_metadata), language="yaml")
|
|
48
|
-
details = mk.MkAdmonition(code, title=
|
|
46
|
+
details = mk.MkAdmonition(code, title="Metadata", collapsible=True, typ="quote")
|
|
49
47
|
adm += details
|
|
50
48
|
|
|
51
49
|
page += adm
|
|
@@ -178,7 +176,7 @@ class BuildCollector:
|
|
|
178
176
|
root: A node to collect build stuff from
|
|
179
177
|
theme: A theme to collect build stuff from.
|
|
180
178
|
"""
|
|
181
|
-
logger.debug("Collecting
|
|
179
|
+
logger.debug("Collecting resources...")
|
|
182
180
|
for _, node in itertools.chain(theme.iter_nodes(), root.iter_nodes()):
|
|
183
181
|
self.node_counter.update([node.__class__.__name__])
|
|
184
182
|
self.extra_files |= node.files
|
|
@@ -193,20 +191,22 @@ class BuildCollector:
|
|
|
193
191
|
self.render_page(page)
|
|
194
192
|
case mk.MkNav() as nav:
|
|
195
193
|
self.render_nav(nav)
|
|
196
|
-
|
|
194
|
+
# theme
|
|
195
|
+
logger.debug("Collecting theme resources...")
|
|
197
196
|
reqs = theme.get_resources()
|
|
198
197
|
self.resources.merge(reqs)
|
|
199
198
|
logger.debug("Adapting collected extensions to theme...")
|
|
200
199
|
theme.adapt_extensions(self.resources.markdown_extensions)
|
|
201
|
-
|
|
200
|
+
# templates
|
|
202
201
|
templates = [
|
|
203
202
|
i.template if isinstance(i, mk.MkPage) else i.page_template
|
|
204
203
|
for i in self.mapping.values()
|
|
205
204
|
]
|
|
206
205
|
templates += theme.templates
|
|
207
206
|
templates = [i for i in templates if i]
|
|
207
|
+
build_files = self.node_files | self.extra_files
|
|
208
208
|
for backend in self.backends:
|
|
209
|
-
logger.info("%s:
|
|
209
|
+
logger.info("%s: Writing data..", type(backend).__name__)
|
|
210
210
|
backend.collect(build_files, self.resources, templates)
|
|
211
211
|
return buildcontext.BuildContext(
|
|
212
212
|
page_mapping=self.mapping,
|
|
@@ -255,7 +255,7 @@ class BuildCollector:
|
|
|
255
255
|
Arguments:
|
|
256
256
|
nav: Nav to collect the data from.
|
|
257
257
|
"""
|
|
258
|
-
logger.info("Processing section %r...", nav.
|
|
258
|
+
logger.info("Processing section %r...", nav.title or "[ROOT]")
|
|
259
259
|
path = nav.resolved_file_path
|
|
260
260
|
self.mapping[path] = nav
|
|
261
261
|
req = nav.get_node_resources()
|
|
@@ -22,7 +22,7 @@ cli = t.Typer(
|
|
|
22
22
|
name="MkNodes",
|
|
23
23
|
help=(
|
|
24
24
|
" 🚀🚀🚀 MkNodes CLI interface. Build websites from command line! 🚀🚀🚀\n\n"
|
|
25
|
-
"Check out https://phil65.github.io/
|
|
25
|
+
"Check out https://phil65.github.io/mkdocs-mknodes/ !"
|
|
26
26
|
),
|
|
27
27
|
no_args_is_help=True,
|
|
28
28
|
)
|
|
@@ -85,7 +85,7 @@ def build(
|
|
|
85
85
|
Runs the build script on given repository (either locally or a hosted one), adapts
|
|
86
86
|
the config file automatically and creates the HTML website in given site dir.
|
|
87
87
|
|
|
88
|
-
Further info here: https://phil65.github.io/
|
|
88
|
+
Further info here: https://phil65.github.io/mkdocs-mknodes/CLI/
|
|
89
89
|
"""
|
|
90
90
|
build_page.build(
|
|
91
91
|
config_path=config_path,
|
|
@@ -116,7 +116,7 @@ def serve(
|
|
|
116
116
|
Runs the build script on given repository (either locally or a hosted one), adapts
|
|
117
117
|
the config file automatically and serves a webpage on http://127.0.0.1/8000/.
|
|
118
118
|
|
|
119
|
-
Further info here: https://phil65.github.io/
|
|
119
|
+
Further info here: https://phil65.github.io/mkdocs-mknodes/CLI/
|
|
120
120
|
"""
|
|
121
121
|
serve_.serve(
|
|
122
122
|
config_path=config_path,
|
|
@@ -145,7 +145,7 @@ def create_config(
|
|
|
145
145
|
infers the required resources (CSS / JS / Md extensions) as well as metadata
|
|
146
146
|
and creates a MkDocs config file.
|
|
147
147
|
|
|
148
|
-
Further info here: https://phil65.github.io/
|
|
148
|
+
Further info here: https://phil65.github.io/mkdocs-mknodes/CLI/
|
|
149
149
|
"""
|
|
150
150
|
build_fn = build_fn or paths.DEFAULT_BUILD_FN
|
|
151
151
|
|
|
@@ -10,7 +10,7 @@ CLI_PATH = "mkdocs_mknodes.cli:cli"
|
|
|
10
10
|
@nav.route.page(is_index=True, hide="toc")
|
|
11
11
|
def _(page: mk.MkPage):
|
|
12
12
|
page += mk.MkBinaryImage.for_file("docs/assets/cli.gif")
|
|
13
|
-
page += mk.
|
|
13
|
+
page += mk.MkTemplate("cli_index.jinja")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@nav.route.page("build", icon="wrench")
|
|
@@ -16,17 +16,17 @@ INTRO = (
|
|
|
16
16
|
|
|
17
17
|
@router.route_page("MkNodes plugin for MkDocs", hide="toc", is_homepage=True)
|
|
18
18
|
def _(page: mk.MkPage):
|
|
19
|
-
page += mk.
|
|
19
|
+
page += mk.MkTemplate("index.jinja")
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
@router.route_page("What is MkNodes?", hide="toc")
|
|
23
23
|
def _(page: mk.MkPage):
|
|
24
|
-
page += mk.
|
|
24
|
+
page += mk.MkTemplate("why_should_i_use_mknodes.jinja")
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@router.route_page("Plugin configuration", hide="toc")
|
|
28
28
|
def _(page: mk.MkPage):
|
|
29
|
-
page += mk.
|
|
29
|
+
page += mk.MkTemplate("plugin_configuration.jinja")
|
|
30
30
|
eps = page.ctx.metadata.entry_points.get("mkdocs.plugins", [])
|
|
31
31
|
page += mk.MkDocStrings(
|
|
32
32
|
eps[0].load().config_class,
|
|
@@ -8,7 +8,7 @@ nav = mk.MkNav("Use cases")
|
|
|
8
8
|
|
|
9
9
|
@nav.route.page(is_index=True, hide="toc")
|
|
10
10
|
def _(page: mk.MkPage):
|
|
11
|
-
page += mk.
|
|
11
|
+
page += mk.MkTemplate("use_cases_index.jinja")
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@nav.route.page("Creating a website via config", hide="toc")
|
|
@@ -18,7 +18,7 @@ def _(page: mk.MkPage):
|
|
|
18
18
|
section = file.get_section("plugins", "mknodes", keep_path=True)
|
|
19
19
|
config = section.serialize("yaml")
|
|
20
20
|
variables = dict(config=config)
|
|
21
|
-
page += mk.
|
|
21
|
+
page += mk.MkTemplate("use_case_default_website.jinja", variables=variables)
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@nav.route.page("Set MkNode pages via config", hide="toc")
|
|
@@ -28,13 +28,13 @@ def _(page: mk.MkPage):
|
|
|
28
28
|
section = file.get_section("plugins", "mknodes", keep_path=True)
|
|
29
29
|
config = section.serialize("yaml")
|
|
30
30
|
variables = dict(config=config)
|
|
31
|
-
page += mk.
|
|
31
|
+
page += mk.MkTemplate("use_case_by_config.jinja", variables=variables)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
@nav.route.nav("Sub-Websites")
|
|
35
35
|
def sub_websites(nav: mk.MkNav):
|
|
36
36
|
page = nav.add_page(is_index=True)
|
|
37
|
-
page += mk.
|
|
37
|
+
page += mk.MkTemplate("use_case_subwebsites.jinja")
|
|
38
38
|
# page += mk.MkCode.for_object(sub_websites)
|
|
39
39
|
proj = mk.Project.for_path("https://github.com/mkdocstrings/mkdocstrings.git")
|
|
40
40
|
website_nav = mk.MkDefaultWebsite(section="MkDocStrings", context=proj.context)
|
|
@@ -13,12 +13,12 @@ from typing import IO, Any
|
|
|
13
13
|
from urllib import parse
|
|
14
14
|
|
|
15
15
|
import jinja2
|
|
16
|
+
import jinjarope
|
|
16
17
|
|
|
17
18
|
from mkdocs.commands import get_deps
|
|
18
19
|
from mkdocs.config.defaults import MkDocsConfig
|
|
19
20
|
from mkdocs.plugins import get_plugin_logger
|
|
20
21
|
from mknodes.info import contexts
|
|
21
|
-
from mknodes.jinja import loaders
|
|
22
22
|
from mknodes.mdlib import mdconverter
|
|
23
23
|
from mknodes.utils import pathhelpers, reprhelpers
|
|
24
24
|
|
|
@@ -218,7 +218,7 @@ class Config:
|
|
|
218
218
|
|
|
219
219
|
def get_jinja_config(self) -> Sequence[jinja2.BaseLoader]:
|
|
220
220
|
cfg = self.plugin.config.get_jinja_config()
|
|
221
|
-
cfg["loader"] |=
|
|
221
|
+
cfg["loader"] |= jinjarope.FileSystemLoader(self.docs_dir)
|
|
222
222
|
return cfg
|
|
223
223
|
|
|
224
224
|
def get_install_candidates(self) -> list[str]:
|
|
@@ -6,9 +6,10 @@ from collections.abc import Callable, Sequence
|
|
|
6
6
|
import functools
|
|
7
7
|
|
|
8
8
|
import jinja2
|
|
9
|
+
import jinjarope
|
|
9
10
|
|
|
11
|
+
from jinjarope import loaders
|
|
10
12
|
from mkdocs.config import base, config_options as c
|
|
11
|
-
from mknodes.jinja import loaders
|
|
12
13
|
from mknodes.utils import classhelpers
|
|
13
14
|
|
|
14
15
|
|
|
@@ -129,7 +130,7 @@ class PluginConfig(base.Config):
|
|
|
129
130
|
variable_start_string=self.jinja_variable_start_string,
|
|
130
131
|
variable_end_string=self.jinja_variable_end_string,
|
|
131
132
|
undefined=self.jinja_on_undefined,
|
|
132
|
-
loader=
|
|
133
|
+
loader=jinjarope.ChoiceLoader(self.get_loaders()),
|
|
133
134
|
)
|
|
134
135
|
|
|
135
136
|
def get_loaders(self) -> Sequence[jinja2.BaseLoader]:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
{{ ["version", "status"] | MkShields }}
|
|
6
6
|
|
|
7
|
-
{{ "https://phil65.github.io/
|
|
7
|
+
{{ "https://phil65.github.io/mkdocs-mknodes/" | MkLink("Read the completely coded documentation!")}}
|
|
8
8
|
|
|
9
9
|
{{ "mkdocs_mknodes" | MkInstallGuide }}
|
|
10
10
|
|
{mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_case_by_config.jinja
RENAMED
|
@@ -14,6 +14,6 @@ Combined with this CLI call...
|
|
|
14
14
|
Will create this website:
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
{{ "https://phil65.github.io/
|
|
17
|
+
{{ "https://phil65.github.io/mkdocs-mknodes/mkdocstrings" | MkLink(as_button=True, icon="web") }}
|
|
18
18
|
|
|
19
19
|
|
{mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_case_subwebsites.jinja
RENAMED
|
@@ -7,7 +7,7 @@ The following code is used to build this section:
|
|
|
7
7
|
@nav.route.nav("Sub-Websites")
|
|
8
8
|
def sub_websites(nav: mk.MkNav):
|
|
9
9
|
page = nav.add_page(is_index=True)
|
|
10
|
-
page += mk.
|
|
10
|
+
page += mk.MkTemplate("use_case_subwebsites.jinja") # what you are reading now
|
|
11
11
|
proj = mk.Project.for_path("https://github.com/mkdocstrings/mkdocstrings.git")
|
|
12
12
|
website_nav = mk.MkDefaultWebsite(section="MkDocStrings", context=proj.context)
|
|
13
13
|
nav += website_nav
|
{mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/use_cases_index.jinja
RENAMED
|
@@ -8,7 +8,7 @@ websites. This section will highlight some of them.
|
|
|
8
8
|
* **MkNodes** can be used to create a whole website (like it is done with this page)
|
|
9
9
|
The most useful setup probably would be to put the whole navigation into code,
|
|
10
10
|
create MkCodes via code when the complexity favours that, and otherwise just
|
|
11
|
-
use [MkPage.from_file][mknodes.MkPage.from_file] or [
|
|
11
|
+
use [MkPage.from_file][mknodes.MkPage.from_file] or [MkTemplate][mknodes.MkTemplate] to embed static pages. That way
|
|
12
12
|
you can get the best of both worlds, the simplicity from writing markdown files
|
|
13
13
|
combined with the possibilities of using python for repititive work or
|
|
14
14
|
more complex / dynamic tasks.
|
|
@@ -8,7 +8,7 @@ websites. This section will highlight some of them.
|
|
|
8
8
|
* **MkNodes** can be used to create a whole website (like it is done with this page)
|
|
9
9
|
The most useful setup probably would be to put the whole navigation into code,
|
|
10
10
|
create MkCodes via code when the complexity favours that, and otherwise just
|
|
11
|
-
use `MkPage.from_file` or `
|
|
11
|
+
use `MkPage.from_file` or `MkTemplate` to embed static pages. That way
|
|
12
12
|
you can get the best of both worlds, the simplicity from writing markdown files
|
|
13
13
|
combined with the possibilities of using python for repititive work or
|
|
14
14
|
more complex / dynamic tasks.
|
|
@@ -110,6 +110,7 @@ dependencies = [
|
|
|
110
110
|
|
|
111
111
|
# Tools
|
|
112
112
|
"jinja2",
|
|
113
|
+
"jinjarope",
|
|
113
114
|
"universal_pathlib",
|
|
114
115
|
]
|
|
115
116
|
license = "MIT"
|
|
@@ -121,7 +122,7 @@ mknodes = "mkdocs_mknodes.cli:cli"
|
|
|
121
122
|
mknodes = "mkdocs_mknodes.plugin:MkNodesPlugin"
|
|
122
123
|
|
|
123
124
|
[project.urls]
|
|
124
|
-
Documentation = "https://phil65.github.io/
|
|
125
|
+
Documentation = "https://phil65.github.io/mkdocs-mknodes/"
|
|
125
126
|
Source = "https://github.com/phil65/mkdocs_mknodes"
|
|
126
127
|
Gitter = "https://app.gitter.im/#/room/#mknodes:gitter.im"
|
|
127
128
|
|
mkdocs_mknodes-0.3.3/Makefile
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.PHONY: help clean test lint format docs serve update
|
|
2
|
-
.DEFAULT_GOAL := help
|
|
3
|
-
|
|
4
|
-
define PRINT_HELP_PYSCRIPT
|
|
5
|
-
import re, sys
|
|
6
|
-
|
|
7
|
-
for line in sys.stdin:
|
|
8
|
-
match = re.match(r"^([a-zA-Z_-]+):.*?## (.*)$$", line)
|
|
9
|
-
if match:
|
|
10
|
-
target, help = match.groups()
|
|
11
|
-
print("%-20s %s" % (target, help))
|
|
12
|
-
endef
|
|
13
|
-
export PRINT_HELP_PYSCRIPT
|
|
14
|
-
|
|
15
|
-
help:
|
|
16
|
-
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
|
17
|
-
|
|
18
|
-
clean: ## remove all build, test, coverage and Python artifacts
|
|
19
|
-
git clean -dfX
|
|
20
|
-
|
|
21
|
-
test: ## run tests
|
|
22
|
-
hatch run test
|
|
23
|
-
|
|
24
|
-
lint: ## run mypy type checking
|
|
25
|
-
hatch run lint-check
|
|
26
|
-
|
|
27
|
-
format: ## run mypy type checking
|
|
28
|
-
hatch run lint
|
|
29
|
-
|
|
30
|
-
docs: ## builds the documentation
|
|
31
|
-
hatch run mkdocs build -v
|
|
32
|
-
|
|
33
|
-
serve: ## run html server watching file changes in realtime
|
|
34
|
-
hatch run mkdocs serve -v
|
|
35
|
-
|
|
36
|
-
update: ## update all packages
|
|
37
|
-
hatch run python -m pip --disable-pip-version-check list --outdated --format=json | python -c "import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))" | xargs -n1 hatch run python -m pip install -U
|
|
38
|
-
hatch run python -m pip install -e .
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs_mknodes-0.3.3 → mkdocs_mknodes-0.3.5}/mkdocs_mknodes/resources/plugin_configuration.jinja
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|