mkdocs-ng 1.6.2__py3-none-any.whl

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.

Potentially problematic release.


This version of mkdocs-ng might be problematic. Click here for more details.

Files changed (174) hide show
  1. mkdocs/__init__.py +5 -0
  2. mkdocs/__main__.py +369 -0
  3. mkdocs/commands/__init__.py +0 -0
  4. mkdocs/commands/build.py +369 -0
  5. mkdocs/commands/gh_deploy.py +169 -0
  6. mkdocs/commands/new.py +53 -0
  7. mkdocs/commands/serve.py +110 -0
  8. mkdocs/config/__init__.py +3 -0
  9. mkdocs/config/base.py +390 -0
  10. mkdocs/config/config_options.py +1219 -0
  11. mkdocs/config/defaults.py +218 -0
  12. mkdocs/contrib/__init__.py +0 -0
  13. mkdocs/contrib/search/__init__.py +120 -0
  14. mkdocs/contrib/search/lunr-language/lunr.ar.js +381 -0
  15. mkdocs/contrib/search/lunr-language/lunr.da.js +284 -0
  16. mkdocs/contrib/search/lunr-language/lunr.de.js +384 -0
  17. mkdocs/contrib/search/lunr-language/lunr.du.js +450 -0
  18. mkdocs/contrib/search/lunr-language/lunr.es.js +599 -0
  19. mkdocs/contrib/search/lunr-language/lunr.fi.js +541 -0
  20. mkdocs/contrib/search/lunr-language/lunr.fr.js +703 -0
  21. mkdocs/contrib/search/lunr-language/lunr.hi.js +123 -0
  22. mkdocs/contrib/search/lunr-language/lunr.hu.js +565 -0
  23. mkdocs/contrib/search/lunr-language/lunr.hy.js +98 -0
  24. mkdocs/contrib/search/lunr-language/lunr.it.js +617 -0
  25. mkdocs/contrib/search/lunr-language/lunr.ja.js +188 -0
  26. mkdocs/contrib/search/lunr-language/lunr.jp.js +5 -0
  27. mkdocs/contrib/search/lunr-language/lunr.kn.js +110 -0
  28. mkdocs/contrib/search/lunr-language/lunr.ko.js +114 -0
  29. mkdocs/contrib/search/lunr-language/lunr.multi.js +79 -0
  30. mkdocs/contrib/search/lunr-language/lunr.nl.js +448 -0
  31. mkdocs/contrib/search/lunr-language/lunr.no.js +258 -0
  32. mkdocs/contrib/search/lunr-language/lunr.pt.js +570 -0
  33. mkdocs/contrib/search/lunr-language/lunr.ro.js +558 -0
  34. mkdocs/contrib/search/lunr-language/lunr.ru.js +391 -0
  35. mkdocs/contrib/search/lunr-language/lunr.sa.js +110 -0
  36. mkdocs/contrib/search/lunr-language/lunr.stemmer.support.js +304 -0
  37. mkdocs/contrib/search/lunr-language/lunr.sv.js +256 -0
  38. mkdocs/contrib/search/lunr-language/lunr.ta.js +123 -0
  39. mkdocs/contrib/search/lunr-language/lunr.te.js +122 -0
  40. mkdocs/contrib/search/lunr-language/lunr.th.js +99 -0
  41. mkdocs/contrib/search/lunr-language/lunr.tr.js +1087 -0
  42. mkdocs/contrib/search/lunr-language/lunr.vi.js +84 -0
  43. mkdocs/contrib/search/lunr-language/lunr.zh.js +145 -0
  44. mkdocs/contrib/search/lunr-language/tinyseg.js +206 -0
  45. mkdocs/contrib/search/prebuild-index.js +56 -0
  46. mkdocs/contrib/search/search_index.py +225 -0
  47. mkdocs/contrib/search/templates/search/lunr.js +3475 -0
  48. mkdocs/contrib/search/templates/search/main.js +109 -0
  49. mkdocs/contrib/search/templates/search/worker.js +133 -0
  50. mkdocs/exceptions.py +41 -0
  51. mkdocs/livereload/__init__.py +381 -0
  52. mkdocs/localization.py +92 -0
  53. mkdocs/plugins.py +695 -0
  54. mkdocs/py.typed +0 -0
  55. mkdocs/structure/__init__.py +35 -0
  56. mkdocs/structure/files.py +626 -0
  57. mkdocs/structure/nav.py +255 -0
  58. mkdocs/structure/pages.py +569 -0
  59. mkdocs/structure/toc.py +81 -0
  60. mkdocs/templates/sitemap.xml +11 -0
  61. mkdocs/theme.py +166 -0
  62. mkdocs/themes/__init__.py +0 -0
  63. mkdocs/themes/mkdocs/404.html +12 -0
  64. mkdocs/themes/mkdocs/__init__.py +0 -0
  65. mkdocs/themes/mkdocs/base.html +251 -0
  66. mkdocs/themes/mkdocs/content.html +9 -0
  67. mkdocs/themes/mkdocs/css/base.css +366 -0
  68. mkdocs/themes/mkdocs/css/bootstrap.min.css +12 -0
  69. mkdocs/themes/mkdocs/css/bootstrap.min.css.map +1 -0
  70. mkdocs/themes/mkdocs/css/brands.min.css +6 -0
  71. mkdocs/themes/mkdocs/css/fontawesome.min.css +9 -0
  72. mkdocs/themes/mkdocs/css/solid.min.css +6 -0
  73. mkdocs/themes/mkdocs/css/v4-font-face.min.css +6 -0
  74. mkdocs/themes/mkdocs/img/favicon.ico +0 -0
  75. mkdocs/themes/mkdocs/img/grid.png +0 -0
  76. mkdocs/themes/mkdocs/js/base.js +287 -0
  77. mkdocs/themes/mkdocs/js/bootstrap.bundle.min.js +7 -0
  78. mkdocs/themes/mkdocs/js/bootstrap.bundle.min.js.map +1 -0
  79. mkdocs/themes/mkdocs/js/darkmode.js +65 -0
  80. mkdocs/themes/mkdocs/keyboard-modal.html +40 -0
  81. mkdocs/themes/mkdocs/locales/de/LC_MESSAGES/messages.mo +0 -0
  82. mkdocs/themes/mkdocs/locales/es/LC_MESSAGES/messages.mo +0 -0
  83. mkdocs/themes/mkdocs/locales/fa/LC_MESSAGES/messages.mo +0 -0
  84. mkdocs/themes/mkdocs/locales/fr/LC_MESSAGES/messages.mo +0 -0
  85. mkdocs/themes/mkdocs/locales/id/LC_MESSAGES/messages.mo +0 -0
  86. mkdocs/themes/mkdocs/locales/it/LC_MESSAGES/messages.mo +0 -0
  87. mkdocs/themes/mkdocs/locales/ja/LC_MESSAGES/messages.mo +0 -0
  88. mkdocs/themes/mkdocs/locales/nb/LC_MESSAGES/messages.mo +0 -0
  89. mkdocs/themes/mkdocs/locales/nl/LC_MESSAGES/messages.mo +0 -0
  90. mkdocs/themes/mkdocs/locales/nn/LC_MESSAGES/messages.mo +0 -0
  91. mkdocs/themes/mkdocs/locales/pl/LC_MESSAGES/messages.mo +0 -0
  92. mkdocs/themes/mkdocs/locales/pt_BR/LC_MESSAGES/messages.mo +0 -0
  93. mkdocs/themes/mkdocs/locales/ru/LC_MESSAGES/messages.mo +0 -0
  94. mkdocs/themes/mkdocs/locales/tr/LC_MESSAGES/messages.mo +0 -0
  95. mkdocs/themes/mkdocs/locales/uk/LC_MESSAGES/messages.mo +0 -0
  96. mkdocs/themes/mkdocs/locales/zh_CN/LC_MESSAGES/messages.mo +0 -0
  97. mkdocs/themes/mkdocs/locales/zh_TW/LC_MESSAGES/messages.mo +0 -0
  98. mkdocs/themes/mkdocs/main.html +10 -0
  99. mkdocs/themes/mkdocs/mkdocs_theme.yml +28 -0
  100. mkdocs/themes/mkdocs/nav-sub.html +14 -0
  101. mkdocs/themes/mkdocs/search-modal.html +21 -0
  102. mkdocs/themes/mkdocs/toc.html +26 -0
  103. mkdocs/themes/mkdocs/webfonts/fa-brands-400.ttf +0 -0
  104. mkdocs/themes/mkdocs/webfonts/fa-brands-400.woff2 +0 -0
  105. mkdocs/themes/mkdocs/webfonts/fa-regular-400.ttf +0 -0
  106. mkdocs/themes/mkdocs/webfonts/fa-regular-400.woff2 +0 -0
  107. mkdocs/themes/mkdocs/webfonts/fa-solid-900.ttf +0 -0
  108. mkdocs/themes/mkdocs/webfonts/fa-solid-900.woff2 +0 -0
  109. mkdocs/themes/mkdocs/webfonts/fa-v4compatibility.ttf +0 -0
  110. mkdocs/themes/mkdocs/webfonts/fa-v4compatibility.woff2 +0 -0
  111. mkdocs/themes/readthedocs/404.html +9 -0
  112. mkdocs/themes/readthedocs/__init__.py +0 -0
  113. mkdocs/themes/readthedocs/base.html +199 -0
  114. mkdocs/themes/readthedocs/breadcrumbs.html +44 -0
  115. mkdocs/themes/readthedocs/css/fonts/Roboto-Slab-Bold.woff +0 -0
  116. mkdocs/themes/readthedocs/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  117. mkdocs/themes/readthedocs/css/fonts/Roboto-Slab-Regular.woff +0 -0
  118. mkdocs/themes/readthedocs/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  119. mkdocs/themes/readthedocs/css/fonts/fontawesome-webfont.eot +0 -0
  120. mkdocs/themes/readthedocs/css/fonts/fontawesome-webfont.svg +2671 -0
  121. mkdocs/themes/readthedocs/css/fonts/fontawesome-webfont.ttf +0 -0
  122. mkdocs/themes/readthedocs/css/fonts/fontawesome-webfont.woff +0 -0
  123. mkdocs/themes/readthedocs/css/fonts/fontawesome-webfont.woff2 +0 -0
  124. mkdocs/themes/readthedocs/css/fonts/lato-bold-italic.woff +0 -0
  125. mkdocs/themes/readthedocs/css/fonts/lato-bold-italic.woff2 +0 -0
  126. mkdocs/themes/readthedocs/css/fonts/lato-bold.woff +0 -0
  127. mkdocs/themes/readthedocs/css/fonts/lato-bold.woff2 +0 -0
  128. mkdocs/themes/readthedocs/css/fonts/lato-normal-italic.woff +0 -0
  129. mkdocs/themes/readthedocs/css/fonts/lato-normal-italic.woff2 +0 -0
  130. mkdocs/themes/readthedocs/css/fonts/lato-normal.woff +0 -0
  131. mkdocs/themes/readthedocs/css/fonts/lato-normal.woff2 +0 -0
  132. mkdocs/themes/readthedocs/css/theme.css +13 -0
  133. mkdocs/themes/readthedocs/css/theme_extra.css +197 -0
  134. mkdocs/themes/readthedocs/footer.html +26 -0
  135. mkdocs/themes/readthedocs/img/favicon.ico +0 -0
  136. mkdocs/themes/readthedocs/js/html5shiv.min.js +4 -0
  137. mkdocs/themes/readthedocs/js/jquery-3.6.0.min.js +2 -0
  138. mkdocs/themes/readthedocs/js/theme.js +2 -0
  139. mkdocs/themes/readthedocs/js/theme_extra.js +8 -0
  140. mkdocs/themes/readthedocs/locales/de/LC_MESSAGES/messages.mo +0 -0
  141. mkdocs/themes/readthedocs/locales/es/LC_MESSAGES/messages.mo +0 -0
  142. mkdocs/themes/readthedocs/locales/fa/LC_MESSAGES/messages.mo +0 -0
  143. mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.mo +0 -0
  144. mkdocs/themes/readthedocs/locales/id/LC_MESSAGES/messages.mo +0 -0
  145. mkdocs/themes/readthedocs/locales/it/LC_MESSAGES/messages.mo +0 -0
  146. mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.mo +0 -0
  147. mkdocs/themes/readthedocs/locales/nl/LC_MESSAGES/messages.mo +0 -0
  148. mkdocs/themes/readthedocs/locales/pl/LC_MESSAGES/messages.mo +0 -0
  149. mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.mo +0 -0
  150. mkdocs/themes/readthedocs/locales/ru/LC_MESSAGES/messages.mo +0 -0
  151. mkdocs/themes/readthedocs/locales/tr/LC_MESSAGES/messages.mo +0 -0
  152. mkdocs/themes/readthedocs/locales/uk/LC_MESSAGES/messages.mo +0 -0
  153. mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.mo +0 -0
  154. mkdocs/themes/readthedocs/locales/zh_TW/LC_MESSAGES/messages.mo +0 -0
  155. mkdocs/themes/readthedocs/main.html +10 -0
  156. mkdocs/themes/readthedocs/mkdocs_theme.yml +25 -0
  157. mkdocs/themes/readthedocs/nav.html +22 -0
  158. mkdocs/themes/readthedocs/search.html +16 -0
  159. mkdocs/themes/readthedocs/searchbox.html +5 -0
  160. mkdocs/themes/readthedocs/toc.html +12 -0
  161. mkdocs/themes/readthedocs/versions.html +27 -0
  162. mkdocs/utils/__init__.py +411 -0
  163. mkdocs/utils/babel_stub.py +29 -0
  164. mkdocs/utils/cache.py +36 -0
  165. mkdocs/utils/filters.py +1 -0
  166. mkdocs/utils/meta.py +101 -0
  167. mkdocs/utils/rendering.py +104 -0
  168. mkdocs/utils/templates.py +55 -0
  169. mkdocs/utils/yaml.py +150 -0
  170. mkdocs_ng-1.6.2.dist-info/METADATA +145 -0
  171. mkdocs_ng-1.6.2.dist-info/RECORD +174 -0
  172. mkdocs_ng-1.6.2.dist-info/WHEEL +4 -0
  173. mkdocs_ng-1.6.2.dist-info/entry_points.txt +9 -0
  174. mkdocs_ng-1.6.2.dist-info/licenses/LICENSE +27 -0
mkdocs/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python
2
+
3
+
4
+ # For acceptable version formats, see https://www.python.org/dev/peps/pep-0440/
5
+ __version__ = '1.6.2'
mkdocs/__main__.py ADDED
@@ -0,0 +1,369 @@
1
+ #!/usr/bin/env python
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ import os
7
+ import shutil
8
+ import sys
9
+ import textwrap
10
+ import traceback
11
+ import warnings
12
+
13
+ import click
14
+
15
+ from mkdocs import __version__, config, utils
16
+
17
+ if sys.platform.startswith("win"):
18
+ try:
19
+ import colorama
20
+ except ImportError:
21
+ pass
22
+ else:
23
+ colorama.init()
24
+
25
+ log = logging.getLogger(__name__)
26
+
27
+
28
+ def _showwarning(message, category, filename, lineno, file=None, line=None):
29
+ try:
30
+ # Last stack frames:
31
+ # * ...
32
+ # * Location of call to deprecated function <-- include this
33
+ # * Location of call to warn() <-- include this
34
+ # * (stdlib) Location of call to showwarning function
35
+ # * (this function) Location of call to extract_stack()
36
+ stack = [frame for frame in traceback.extract_stack() if frame.line][-4:-2]
37
+ # Make sure the actual affected file's name is still present (the case of syntax warning):
38
+ if not any(frame.filename == filename for frame in stack):
39
+ stack = [*stack[-1:], traceback.FrameSummary(filename, lineno, '')]
40
+
41
+ tb = ''.join(traceback.format_list(stack))
42
+ except Exception:
43
+ tb = f' File "{filename}", line {lineno}'
44
+
45
+ log.info(f'{category.__name__}: {message}\n{tb}')
46
+
47
+
48
+ def _enable_warnings():
49
+ # When `python -W...` or `PYTHONWARNINGS` are used, `sys.warnoptions` is set.
50
+ # In that case, we skip warnings configuration since
51
+ # we don't want to overwrite the user configuration.
52
+ if not sys.warnoptions:
53
+ from mkdocs.commands import build
54
+
55
+ build.log.addFilter(utils.DuplicateFilter())
56
+
57
+ warnings.simplefilter('module', DeprecationWarning)
58
+ warnings.showwarning = _showwarning
59
+
60
+
61
+ class ColorFormatter(logging.Formatter):
62
+ colors = {
63
+ 'CRITICAL': 'red',
64
+ 'ERROR': 'red',
65
+ 'WARNING': 'yellow',
66
+ 'DEBUG': 'blue',
67
+ }
68
+
69
+ text_wrapper = textwrap.TextWrapper(
70
+ width=shutil.get_terminal_size(fallback=(0, 0)).columns,
71
+ replace_whitespace=False,
72
+ break_long_words=False,
73
+ break_on_hyphens=False,
74
+ initial_indent=' ' * 11,
75
+ subsequent_indent=' ' * 11,
76
+ )
77
+
78
+ def format(self, record):
79
+ message = super().format(record)
80
+ prefix = f'{record.levelname:<8}- '
81
+ if record.levelname in self.colors:
82
+ prefix = click.style(prefix, fg=self.colors[record.levelname])
83
+ if self.text_wrapper.width:
84
+ # Only wrap text if a terminal width was detected
85
+ msg = '\n'.join(self.text_wrapper.fill(line) for line in message.splitlines())
86
+ # Prepend prefix after wrapping so that color codes don't affect length
87
+ return prefix + msg[11:]
88
+ return prefix + message
89
+
90
+
91
+ class State:
92
+ """Maintain logging level."""
93
+
94
+ def __init__(self, log_name='mkdocs', level=logging.INFO):
95
+ self.logger = logging.getLogger(log_name)
96
+ self.logger.setLevel(level)
97
+ self.logger.propagate = False
98
+
99
+ self.stream = logging.StreamHandler()
100
+ self.stream.setFormatter(ColorFormatter())
101
+ self.stream.name = 'MkDocsStreamHandler'
102
+ self.logger.addHandler(self.stream)
103
+
104
+ def __del__(self):
105
+ self.logger.removeHandler(self.stream)
106
+
107
+
108
+ pass_state = click.make_pass_decorator(State, ensure=True)
109
+
110
+ clean_help = "Remove old files from the site_dir before building (the default)."
111
+ config_help = (
112
+ "Provide a specific MkDocs config. This can be a file name, or '-' to read from stdin."
113
+ )
114
+ dev_addr_help = "IP address and port to serve documentation locally (default: localhost:8000)"
115
+ serve_open_help = "Open the website in a Web browser after the initial build finishes."
116
+ strict_help = "Enable strict mode. This will cause MkDocs to abort the build on any warnings."
117
+ theme_help = "The theme to use when building your documentation."
118
+ theme_choices = sorted(utils.get_theme_names())
119
+ site_dir_help = "The directory to output the result of the documentation build."
120
+ use_directory_urls_help = "Use directory URLs when building pages (the default)."
121
+ reload_help = "Enable the live reloading in the development server (this is the default)"
122
+ no_reload_help = "Disable the live reloading in the development server."
123
+ serve_dirty_help = "Only re-build files that have changed."
124
+ serve_clean_help = (
125
+ "Build the site without any effects of `mkdocs serve` - pure `mkdocs build`, then serve."
126
+ )
127
+ commit_message_help = (
128
+ "A commit message to use when committing to the "
129
+ "GitHub Pages remote branch. Commit {sha} and MkDocs {version} are available as expansions"
130
+ )
131
+ remote_branch_help = (
132
+ "The remote branch to commit to for GitHub Pages. This "
133
+ "overrides the value specified in config"
134
+ )
135
+ remote_name_help = (
136
+ "The remote name to commit to for GitHub Pages. This overrides the value specified in config"
137
+ )
138
+ force_help = "Force the push to the repository."
139
+ no_history_help = "Replace the whole Git history with one new commit."
140
+ ignore_version_help = (
141
+ "Ignore check that build is not being deployed with an older version of MkDocs."
142
+ )
143
+ watch_theme_help = (
144
+ "Include the theme in list of files to watch for live reloading. "
145
+ "Ignored when live reload is not used."
146
+ )
147
+ shell_help = "Use the shell when invoking Git."
148
+ watch_help = "A directory or file to watch for live reloading. Can be supplied multiple times."
149
+ projects_file_help = (
150
+ "URL or local path of the registry file that declares all known MkDocs-related projects."
151
+ )
152
+
153
+
154
+ def add_options(*opts):
155
+ def inner(f):
156
+ for i in reversed(opts):
157
+ f = i(f)
158
+ return f
159
+
160
+ return inner
161
+
162
+
163
+ def verbose_option(f):
164
+ def callback(ctx, param, value):
165
+ state = ctx.ensure_object(State)
166
+ if value:
167
+ state.logger.setLevel(logging.DEBUG)
168
+
169
+ return click.option(
170
+ '-v',
171
+ '--verbose',
172
+ is_flag=True,
173
+ expose_value=False,
174
+ help='Enable verbose output',
175
+ callback=callback,
176
+ )(f)
177
+
178
+
179
+ def quiet_option(f):
180
+ def callback(ctx, param, value):
181
+ state = ctx.ensure_object(State)
182
+ if value:
183
+ state.logger.setLevel(logging.ERROR)
184
+
185
+ return click.option(
186
+ '-q',
187
+ '--quiet',
188
+ is_flag=True,
189
+ expose_value=False,
190
+ help='Silence warnings',
191
+ callback=callback,
192
+ )(f)
193
+
194
+
195
+ def color_option(f):
196
+ def callback(ctx, param, value):
197
+ state = ctx.ensure_object(State)
198
+ if value is False or (
199
+ value is None
200
+ and (
201
+ not sys.stdout.isatty()
202
+ or os.environ.get('NO_COLOR')
203
+ or os.environ.get('TERM') == 'dumb'
204
+ )
205
+ ):
206
+ state.stream.setFormatter(logging.Formatter('%(levelname)-8s- %(message)s'))
207
+
208
+ return click.option(
209
+ '--color/--no-color',
210
+ is_flag=True,
211
+ default=None,
212
+ expose_value=False,
213
+ help="Force enable or disable color and wrapping for the output. Default is auto-detect.",
214
+ callback=callback,
215
+ )(f)
216
+
217
+
218
+ common_options = add_options(quiet_option, verbose_option)
219
+ common_config_options = add_options(
220
+ click.option('-f', '--config-file', type=click.File('rb'), help=config_help),
221
+ # Don't override config value if user did not specify --strict flag
222
+ # Conveniently, load_config drops None values
223
+ click.option('-s', '--strict/--no-strict', is_flag=True, default=None, help=strict_help),
224
+ click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help),
225
+ # As with --strict, set the default to None so that this doesn't incorrectly
226
+ # override the config file
227
+ click.option(
228
+ '--use-directory-urls/--no-directory-urls',
229
+ is_flag=True,
230
+ default=None,
231
+ help=use_directory_urls_help,
232
+ ),
233
+ )
234
+
235
+ PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
236
+
237
+ PKG_DIR = os.path.dirname(os.path.abspath(__file__))
238
+
239
+
240
+ @click.group(context_settings=dict(help_option_names=['-h', '--help'], max_content_width=120))
241
+ @click.version_option(
242
+ __version__,
243
+ '-V',
244
+ '--version',
245
+ message=f'%(prog)s, version %(version)s from { PKG_DIR } (Python { PYTHON_VERSION })',
246
+ )
247
+ @common_options
248
+ @color_option
249
+ def cli():
250
+ """MkDocs - Project documentation with Markdown."""
251
+
252
+
253
+ @cli.command(name="serve")
254
+ @click.option('-a', '--dev-addr', help=dev_addr_help, metavar='<IP:PORT>')
255
+ @click.option('-o', '--open', 'open_in_browser', help=serve_open_help, is_flag=True)
256
+ @click.option('--livereload/--no-livereload', default=True, help='Enable/disable live reloading.')
257
+ @click.option('--dirtyreload', 'build_type', flag_value='dirty', hidden=True)
258
+ @click.option('--dirty', 'build_type', flag_value='dirty', help=serve_dirty_help)
259
+ @click.option('-c', '--clean', 'build_type', flag_value='clean', help=serve_clean_help)
260
+ @click.option('--watch-theme', help=watch_theme_help, is_flag=True)
261
+ @click.option(
262
+ '-w', '--watch', help=watch_help, type=click.Path(exists=True), multiple=True, default=[]
263
+ )
264
+ @common_config_options
265
+ @common_options
266
+ def serve_command(**kwargs):
267
+ """Run the builtin development server."""
268
+ from mkdocs.commands import serve
269
+
270
+ _enable_warnings()
271
+ serve.serve(**kwargs)
272
+
273
+
274
+ @cli.command(name="build")
275
+ @click.option('-c', '--clean/--dirty', is_flag=True, default=True, help=clean_help)
276
+ @common_config_options
277
+ @click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)
278
+ @common_options
279
+ def build_command(clean, **kwargs):
280
+ """Build the MkDocs documentation."""
281
+ from mkdocs.commands import build
282
+
283
+ _enable_warnings()
284
+ cfg = config.load_config(**kwargs)
285
+ cfg.plugins.on_startup(command='build', dirty=not clean)
286
+ try:
287
+ build.build(cfg, dirty=not clean)
288
+ finally:
289
+ cfg.plugins.on_shutdown()
290
+
291
+
292
+ @cli.command(name="gh-deploy")
293
+ @click.option('-c', '--clean/--dirty', is_flag=True, default=True, help=clean_help)
294
+ @click.option('-m', '--message', help=commit_message_help)
295
+ @click.option('-b', '--remote-branch', help=remote_branch_help)
296
+ @click.option('-r', '--remote-name', help=remote_name_help)
297
+ @click.option('--force', is_flag=True, help=force_help)
298
+ @click.option('--no-history', is_flag=True, help=no_history_help)
299
+ @click.option('--ignore-version', is_flag=True, help=ignore_version_help)
300
+ @click.option('--shell', is_flag=True, help=shell_help)
301
+ @common_config_options
302
+ @click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)
303
+ @common_options
304
+ def gh_deploy_command(
305
+ clean, message, remote_branch, remote_name, force, no_history, ignore_version, shell, **kwargs
306
+ ):
307
+ """Deploy your documentation to GitHub Pages."""
308
+ from mkdocs.commands import build, gh_deploy
309
+
310
+ _enable_warnings()
311
+ cfg = config.load_config(remote_branch=remote_branch, remote_name=remote_name, **kwargs)
312
+ cfg.plugins.on_startup(command='gh-deploy', dirty=not clean)
313
+ try:
314
+ build.build(cfg, dirty=not clean)
315
+ finally:
316
+ cfg.plugins.on_shutdown()
317
+ gh_deploy.gh_deploy(
318
+ cfg,
319
+ message=message,
320
+ force=force,
321
+ no_history=no_history,
322
+ ignore_version=ignore_version,
323
+ shell=shell,
324
+ )
325
+
326
+
327
+ @cli.command(name="get-deps")
328
+ @verbose_option
329
+ @click.option('-f', '--config-file', type=click.File('rb'), help=config_help)
330
+ @click.option(
331
+ '-p',
332
+ '--projects-file',
333
+ default=None,
334
+ help=projects_file_help,
335
+ show_default=True,
336
+ )
337
+ def get_deps_command(config_file, projects_file):
338
+ """Show required PyPI packages inferred from plugins in mkdocs.yml."""
339
+ from mkdocs_get_deps import get_deps, get_projects_file
340
+
341
+ from mkdocs.config.base import _open_config_file
342
+
343
+ warning_counter = utils.CountHandler()
344
+ warning_counter.setLevel(logging.WARNING)
345
+ logging.getLogger('mkdocs').addHandler(warning_counter)
346
+
347
+ with get_projects_file(projects_file) as p:
348
+ with _open_config_file(config_file) as f:
349
+ deps = get_deps(config_file=f, projects_file=p)
350
+
351
+ for dep in deps:
352
+ print(dep) # noqa: T201
353
+
354
+ if warning_counter.get_counts():
355
+ sys.exit(1)
356
+
357
+
358
+ @cli.command(name="new")
359
+ @click.argument("project_directory")
360
+ @common_options
361
+ def new_command(project_directory):
362
+ """Create a new MkDocs project."""
363
+ from mkdocs.commands import new
364
+
365
+ new.new(project_directory)
366
+
367
+
368
+ if __name__ == '__main__': # pragma: no cover
369
+ cli()
File without changes