mkdocs-techdocs-core 1.5.3__tar.gz → 1.5.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-techdocs-core
3
- Version: 1.5.3
3
+ Version: 1.5.4
4
4
  Summary: The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions
5
5
  Home-page: https://github.com/backstage/mkdocs-techdocs-core
6
6
  Author: TechDocs Core
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: mkdocs>=1.6
25
25
  Requires-Dist: Markdown<3.8,>=3.2
26
- Requires-Dist: mkdocs-material==9.6.5
26
+ Requires-Dist: mkdocs-material==9.6.8
27
27
  Requires-Dist: markdown-graphviz-inline==1.1.3
28
28
  Requires-Dist: mkdocs-monorepo-plugin==1.1.0
29
29
  Requires-Dist: plantuml-markdown==3.11.1
@@ -202,6 +202,10 @@ We only use `material-mkdocs` as base styles because Backstage also uses the `Ma
202
202
 
203
203
  ## Changelog
204
204
 
205
+ ### 1.5.4
206
+
207
+ - Added proper plugin config to fix `Unrecognised configuration name` error when any config is provided
208
+
205
209
  ### 1.5.3
206
210
 
207
211
  - Added support for PyMdown Blocks extensions
@@ -157,6 +157,10 @@ We only use `material-mkdocs` as base styles because Backstage also uses the `Ma
157
157
 
158
158
  ## Changelog
159
159
 
160
+ ### 1.5.4
161
+
162
+ - Added proper plugin config to fix `Unrecognised configuration name` error when any config is provided
163
+
160
164
  ### 1.5.3
161
165
 
162
166
  - Added support for PyMdown Blocks extensions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-techdocs-core
3
- Version: 1.5.3
3
+ Version: 1.5.4
4
4
  Summary: The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions
5
5
  Home-page: https://github.com/backstage/mkdocs-techdocs-core
6
6
  Author: TechDocs Core
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: mkdocs>=1.6
25
25
  Requires-Dist: Markdown<3.8,>=3.2
26
- Requires-Dist: mkdocs-material==9.6.5
26
+ Requires-Dist: mkdocs-material==9.6.8
27
27
  Requires-Dist: markdown-graphviz-inline==1.1.3
28
28
  Requires-Dist: mkdocs-monorepo-plugin==1.1.0
29
29
  Requires-Dist: plantuml-markdown==3.11.1
@@ -202,6 +202,10 @@ We only use `material-mkdocs` as base styles because Backstage also uses the `Ma
202
202
 
203
203
  ## Changelog
204
204
 
205
+ ### 1.5.4
206
+
207
+ - Added proper plugin config to fix `Unrecognised configuration name` error when any config is provided
208
+
205
209
  ### 1.5.3
206
210
 
207
211
  - Added support for PyMdown Blocks extensions
@@ -1,6 +1,6 @@
1
1
  mkdocs>=1.6
2
2
  Markdown<3.8,>=3.2
3
- mkdocs-material==9.6.5
3
+ mkdocs-material==9.6.8
4
4
  markdown-graphviz-inline==1.1.3
5
5
  mkdocs-monorepo-plugin==1.1.0
6
6
  plantuml-markdown==3.11.1
@@ -9,7 +9,7 @@ Markdown>=3.2,<3.8
9
9
  # pinned to an exact version. Bumps should be accompanied by release notes
10
10
  # explaining what was added or fixed (or at least pointing to the underlying
11
11
  # release notes of the bumped package).
12
- mkdocs-material==9.6.5
12
+ mkdocs-material==9.6.8
13
13
  markdown-graphviz-inline==1.1.3
14
14
  mkdocs-monorepo-plugin==1.1.0
15
15
  plantuml-markdown==3.11.1
@@ -28,7 +28,7 @@ with open("requirements.txt") as f:
28
28
 
29
29
  setup(
30
30
  name="mkdocs-techdocs-core",
31
- version="1.5.3",
31
+ version="1.5.4",
32
32
  description="The core MkDocs plugin used by Backstage's TechDocs as a wrapper around "
33
33
  "multiple MkDocs plugins and Python Markdown extensions",
34
34
  long_description=long_description,
@@ -17,6 +17,8 @@
17
17
  import tempfile
18
18
  import logging
19
19
  import os
20
+
21
+ from mkdocs.config import Config, config_options
20
22
  from mkdocs.plugins import BasePlugin
21
23
  from mkdocs.theme import Theme
22
24
  from mkdocs.contrib.search import SearchPlugin
@@ -30,7 +32,12 @@ log = logging.getLogger(__name__)
30
32
  TECHDOCS_DEFAULT_THEME = "material"
31
33
 
32
34
 
33
- class TechDocsCore(BasePlugin):
35
+ class TechDocsCoreConfig(Config):
36
+ use_material_search = config_options.Type(bool, default=False)
37
+ use_pymdownx_blocks = config_options.Type(bool, default=False)
38
+
39
+
40
+ class TechDocsCore(BasePlugin[TechDocsCoreConfig]):
34
41
  def __init__(self):
35
42
  # This directory will be removed automatically once the docs are built
36
43
  # MkDocs needs a directory for the theme with the `techdocs_metadata.json` file
@@ -76,12 +83,8 @@ class TechDocsCore(BasePlugin):
76
83
  config["theme"].dirs.append(self.tmp_dir_techdocs_theme.name)
77
84
 
78
85
  # Plugins
79
- use_material_search = config["plugins"]["techdocs-core"].config.get(
80
- "use_material_search", False
81
- )
82
- use_pymdownx_blocks = config["plugins"]["techdocs-core"].config.get(
83
- "use_pymdownx_blocks", False
84
- )
86
+ use_material_search = self.config["use_material_search"]
87
+ use_pymdownx_blocks = self.config["use_pymdownx_blocks"]
85
88
  del config["plugins"]["techdocs-core"]
86
89
 
87
90
  if use_material_search:
@@ -16,37 +16,37 @@ class DummyTechDocsCorePlugin(plugins.BasePlugin):
16
16
  pass
17
17
 
18
18
 
19
- class TestTechDocsCoreConfig(unittest.TestCase):
19
+ class TestTechDocsCore(unittest.TestCase):
20
20
  def setUp(self):
21
- self.techdocscore = TechDocsCore()
22
21
  self.plugin_collection = plugins.PluginCollection()
23
22
  plugin = DummyTechDocsCorePlugin()
24
23
  self.plugin_collection["techdocs-core"] = plugin
25
- self.mkdocs_yaml_config = {"plugins": self.plugin_collection}
26
- # Note: in reality, config["theme"] is always an instance of Theme
27
- self.mkdocs_yaml_config["theme"] = get_default_theme()
24
+ self.techdocscore = TechDocsCore()
25
+ self.techdocscore.load_config(
26
+ {"plugins": self.plugin_collection, "theme": get_default_theme()}
27
+ )
28
28
 
29
29
  def test_removes_techdocs_core_plugin_from_config(self):
30
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
30
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
31
31
  self.assertTrue("techdocs-core" not in final_config["plugins"])
32
32
 
33
33
  def test_merge_default_config_and_user_config(self):
34
- self.mkdocs_yaml_config["markdown_extension"] = []
35
- self.mkdocs_yaml_config["mdx_configs"] = {}
36
- self.mkdocs_yaml_config["markdown_extension"].append(["toc"])
37
- self.mkdocs_yaml_config["mdx_configs"]["toc"] = {"toc_depth": 3}
38
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
34
+ self.techdocscore.config["markdown_extension"] = []
35
+ self.techdocscore.config["mdx_configs"] = {}
36
+ self.techdocscore.config["markdown_extension"].append(["toc"])
37
+ self.techdocscore.config["mdx_configs"]["toc"] = {"toc_depth": 3}
38
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
39
39
  self.assertTrue("toc" in final_config["mdx_configs"])
40
40
  self.assertTrue("permalink" in final_config["mdx_configs"]["toc"])
41
41
  self.assertTrue("toc_depth" in final_config["mdx_configs"]["toc"])
42
42
  self.assertTrue("mdx_truly_sane_lists" in final_config["markdown_extensions"])
43
43
 
44
44
  def test_override_default_config_with_user_config(self):
45
- self.mkdocs_yaml_config["markdown_extension"] = []
46
- self.mkdocs_yaml_config["mdx_configs"] = {}
47
- self.mkdocs_yaml_config["markdown_extension"].append(["toc"])
48
- self.mkdocs_yaml_config["mdx_configs"]["toc"] = {"permalink": False}
49
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
45
+ self.techdocscore.config["markdown_extension"] = []
46
+ self.techdocscore.config["mdx_configs"] = {}
47
+ self.techdocscore.config["markdown_extension"].append(["toc"])
48
+ self.techdocscore.config["mdx_configs"]["toc"] = {"permalink": False}
49
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
50
50
  self.assertTrue("toc" in final_config["mdx_configs"])
51
51
  self.assertTrue("permalink" in final_config["mdx_configs"]["toc"])
52
52
  self.assertFalse(final_config["mdx_configs"]["toc"]["permalink"])
@@ -54,22 +54,22 @@ class TestTechDocsCoreConfig(unittest.TestCase):
54
54
 
55
55
  def test_theme_overrides_removed_when_name_is_not_material(self):
56
56
  # we want to force the theme mkdocs to this test
57
- self.mkdocs_yaml_config["theme"] = Theme(name="mkdocs")
58
- self.mkdocs_yaml_config["theme"]["features"] = ["navigation.sections"]
59
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
57
+ self.techdocscore.config["theme"] = Theme(name="mkdocs")
58
+ self.techdocscore.config["theme"]["features"] = ["navigation.sections"]
59
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
60
60
  self.assertFalse("navigation.sections" in final_config["theme"]["features"])
61
61
 
62
62
  def test_theme_overrides_when_name_is_material(self):
63
- self.mkdocs_yaml_config["theme"] = Theme(name=TECHDOCS_DEFAULT_THEME)
64
- self.mkdocs_yaml_config["theme"]["features"] = ["navigation.sections"]
65
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
63
+ self.techdocscore.config["theme"] = Theme(name=TECHDOCS_DEFAULT_THEME)
64
+ self.techdocscore.config["theme"]["features"] = ["navigation.sections"]
65
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
66
66
  self.assertTrue("navigation.sections" in final_config["theme"]["features"])
67
67
 
68
68
  def test_theme_overrides_techdocs_metadata(self):
69
- self.mkdocs_yaml_config["theme"] = Theme(
69
+ self.techdocscore.config["theme"] = Theme(
70
70
  name=TECHDOCS_DEFAULT_THEME, static_templates=["my_static_temples"]
71
71
  )
72
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
72
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
73
73
  self.assertTrue("my_static_temples" in final_config["theme"].static_templates)
74
74
  self.assertTrue(
75
75
  "techdocs_metadata.json" in final_config["theme"].static_templates
@@ -77,16 +77,16 @@ class TestTechDocsCoreConfig(unittest.TestCase):
77
77
 
78
78
  def test_theme_overrides_dirs(self):
79
79
  custom_theme_dir = "/tmp/my_custom_theme_dir"
80
- self.mkdocs_yaml_config["theme"] = Theme(name=TECHDOCS_DEFAULT_THEME)
81
- self.mkdocs_yaml_config["theme"].dirs.append(custom_theme_dir)
82
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
80
+ self.techdocscore.config["theme"] = Theme(name=TECHDOCS_DEFAULT_THEME)
81
+ self.techdocscore.config["theme"].dirs.append(custom_theme_dir)
82
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
83
83
  self.assertTrue(custom_theme_dir in final_config["theme"].dirs)
84
84
  self.assertTrue(
85
85
  self.techdocscore.tmp_dir_techdocs_theme.name in final_config["theme"].dirs
86
86
  )
87
87
 
88
88
  def test_template_renders__multiline_value_as_valid_json(self):
89
- self.techdocscore.on_config(self.mkdocs_yaml_config)
89
+ self.techdocscore.on_config(self.techdocscore.config)
90
90
  env = Environment(
91
91
  loader=PackageLoader(
92
92
  "techdocs_core", self.techdocscore.tmp_dir_techdocs_theme.name
@@ -103,11 +103,11 @@ class TestTechDocsCoreConfig(unittest.TestCase):
103
103
  self.assertEqual(config, as_json)
104
104
 
105
105
  def test_restrict_snippet_base_path(self):
106
- self.mkdocs_yaml_config["mdx_configs"] = {
106
+ self.techdocscore.config["mdx_configs"] = {
107
107
  "pymdownx.snippets": {"restrict_base_path": False}
108
108
  }
109
109
 
110
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
110
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
111
111
 
112
112
  self.assertEqual(
113
113
  final_config["mdx_configs"]["pymdownx.snippets"]["restrict_base_path"],
@@ -115,10 +115,8 @@ class TestTechDocsCoreConfig(unittest.TestCase):
115
115
  )
116
116
 
117
117
  def test_material_search(self):
118
- self.plugin_collection["techdocs-core"].load_config(
119
- {"use_material_search": True}
120
- )
121
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
118
+ self.techdocscore.config["use_material_search"] = True
119
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
122
120
 
123
121
  self.assertEqual(
124
122
  final_config["plugins"]["search"].__module__,
@@ -126,17 +124,14 @@ class TestTechDocsCoreConfig(unittest.TestCase):
126
124
  )
127
125
 
128
126
  def test_default_search(self):
129
- self.plugin_collection["techdocs-core"].load_config({})
130
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
127
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
131
128
  self.assertEqual(
132
129
  final_config["plugins"]["search"].__module__, "mkdocs.contrib.search"
133
130
  )
134
131
 
135
132
  def test_pymdownx_blocks(self):
136
- self.plugin_collection["techdocs-core"].load_config(
137
- {"use_pymdownx_blocks": True}
138
- )
139
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
133
+ self.techdocscore.config["use_pymdownx_blocks"] = True
134
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
140
135
 
141
136
  self.assertTrue(
142
137
  "pymdownx.blocks.admonition" in final_config["markdown_extensions"]
@@ -160,8 +155,7 @@ class TestTechDocsCoreConfig(unittest.TestCase):
160
155
  self.assertFalse("pymdownx.tabbed" in final_config["mdx_configs"])
161
156
 
162
157
  def test_default_pymdownx(self):
163
- self.plugin_collection["techdocs-core"].load_config({})
164
- final_config = self.techdocscore.on_config(self.mkdocs_yaml_config)
158
+ final_config = self.techdocscore.on_config(self.techdocscore.config)
165
159
 
166
160
  self.assertFalse(
167
161
  "pymdownx.blocks.admonition" in final_config["markdown_extensions"]