forked from wez/wezterm
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkdocs_macros.py
40 lines (34 loc) · 1.05 KB
/
mkdocs_macros.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
# https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/
def define_env(env):
with open("docs/releases.json") as f:
for (k, v) in json.load(f).items():
env.variables[k] = v
@env.macro
def since(vers, outline=False, inline=False):
if vers == "nightly":
first_line = "*Since: Nightly Builds Only*"
expanded = "+"
blurb = """
The functionality described in this section requires a nightly build of wezterm.
You can obtain a nightly build by following the instructions from the
[Download](/wezterm/installation.html) section.
"""
else:
first_line = f"*Since: Version {vers}*"
expanded = ""
blurb = f"""
*The functionality described in this section requires version {vers} of wezterm,
or a more recent version.*
"""
if outline:
return f"""
!!! info "{first_line}"
{blurb}
"""
if inline:
return f"({first_line})"
return f"""
???{expanded} info "{first_line}"
{blurb}
"""