Restructured documentation (#5692)

This commit is contained in:
Martin Donath
2023-09-14 19:09:18 +02:00
committed by GitHub
parent 19437db8fc
commit cd008fdf29
83 changed files with 6877 additions and 3354 deletions

View File

@@ -80,6 +80,10 @@ class InfoPlugin(BasePlugin[InfoConfig]):
log.error("Please upgrade to the latest version.")
self._help_on_versions_and_exit(present, current)
# Exit if archive creation is disabled
if not self.config.archive:
sys.exit(1)
# Print message that we're creating a bug report
log.info("Started archive creation for bug report")

View File

@@ -41,6 +41,9 @@ pipeline = ("stemmer", "stopWordFilter", "trimmer")
# Search plugin configuration
class SearchConfig(Config):
enabled = Type(bool, default = True)
# Settings for search
lang = Optional(LangOption())
separator = Optional(Type(str))
pipeline = ListOfItems(Choice(pipeline), default = [])

View File

@@ -58,6 +58,10 @@ class SearchPlugin(BasePlugin[SearchConfig]):
# Initialize plugin
def on_config(self, config):
if not self.config.enabled:
return
# Retrieve default value for language
if not self.config.lang:
self.config.lang = [self._translate(
config, "search.config.lang"
@@ -104,6 +108,10 @@ class SearchPlugin(BasePlugin[SearchConfig]):
# Add page to search index
def on_page_context(self, context, *, page, config, nav):
if not self.config.enabled:
return
# Index page
self.search_index.add_entry_from_context(page)
page.content = re.sub(
r"\s?data-search-\w+=\"[^\"]+\"",
@@ -113,6 +121,10 @@ class SearchPlugin(BasePlugin[SearchConfig]):
# Generate search index
def on_post_build(self, *, config):
if not self.config.enabled:
return
# Write search index
base = os.path.join(config.site_dir, "search")
path = os.path.join(base, "search_index.json")

View File

@@ -79,7 +79,7 @@ class SocialPlugin(BasePlugin[SocialConfig]):
if "Image" not in globals():
raise PluginError(
"Required dependencies of \"social\" plugin not found. "
"Install with: pip install pillow cairosvg"
"Install with: pip install \"mkdocs-material[imaging]\""
)
# Move color options