Skip to content

Commit bab3ec5

Browse files
committed
Add a specific expanded warning for formerly-builtin themes
1 parent 0d6f9fb commit bab3ec5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

properdocs/config/config_options.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,14 @@ def run_validation(self, value: object) -> theme.Theme:
812812

813813
themes = utils.get_theme_names()
814814
if theme_config['name'] is not None and theme_config['name'] not in themes:
815-
raise ValidationError(
816-
f"Unrecognised theme name: '{theme_config['name']}'. "
817-
f"The available installed themes are: {', '.join(themes)}"
818-
)
815+
message = f"Unrecognised theme name: '{theme_config['name']}'."
816+
if theme_config['name'] in ('mkdocs', 'readthedocs'):
817+
message += f"\nAdditional dependency is needed:\n pip install properdocs-theme-{theme_config['name']}"
818+
elif themes:
819+
message += f" The available installed themes are: {', '.join(themes)}"
820+
else:
821+
message += " There aren't any themes installed."
822+
raise ValidationError(message)
819823

820824
if not theme_config['name'] and 'custom_dir' not in theme_config:
821825
raise ValidationError("At least one of 'name' or 'custom_dir' must be defined.")

0 commit comments

Comments
 (0)