Skip to content

Commit c31ef00

Browse files
committed
Disabled info plugin on serve by default
1 parent 6119df5 commit c31ef00

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

material/plugins/info/plugin.py

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# Info plugin configuration scheme
4444
class InfoPluginConfig(Config):
4545
enabled = opt.Type(bool, default = True)
46+
enabled_on_serve = opt.Type(bool, default = False)
4647

4748
# Options for archive
4849
archive = opt.Type(bool, default = True)
@@ -54,6 +55,17 @@ class InfoPluginConfig(Config):
5455
# Info plugin
5556
class InfoPlugin(BasePlugin[InfoPluginConfig]):
5657

58+
# Determine whether we're serving
59+
def on_startup(self, *, command, dirty):
60+
if not self.config.enabled:
61+
return
62+
63+
# By default, the plugin is disabled when the documentation is served,
64+
# but not when it is built. This should nicely align with the expected
65+
# user experience when creating reproductions.
66+
if not self.config.enabled_on_serve:
67+
self.config.enabled = command != "serve"
68+
5769
# Initialize plugin (run earliest)
5870
@event_priority(100)
5971
def on_config(self, config):

src/plugins/info/plugin.py

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# Info plugin configuration scheme
4444
class InfoPluginConfig(Config):
4545
enabled = opt.Type(bool, default = True)
46+
enabled_on_serve = opt.Type(bool, default = False)
4647

4748
# Options for archive
4849
archive = opt.Type(bool, default = True)
@@ -54,6 +55,17 @@ class InfoPluginConfig(Config):
5455
# Info plugin
5556
class InfoPlugin(BasePlugin[InfoPluginConfig]):
5657

58+
# Determine whether we're serving
59+
def on_startup(self, *, command, dirty):
60+
if not self.config.enabled:
61+
return
62+
63+
# By default, the plugin is disabled when the documentation is served,
64+
# but not when it is built. This should nicely align with the expected
65+
# user experience when creating reproductions.
66+
if not self.config.enabled_on_serve:
67+
self.config.enabled = command != "serve"
68+
5769
# Initialize plugin (run earliest)
5870
@event_priority(100)
5971
def on_config(self, config):

0 commit comments

Comments
 (0)