mirror of
https://github.com/zulip/zulip.git
synced 2026-06-12 21:00:58 +08:00
docs: Add copy button to code blocks.
Configure the copy button to exclude prompts and line numbers.
This commit is contained in:
parent
6331a7c07a
commit
79af3c4c75
@ -20,6 +20,7 @@ extensions = [
|
||||
"myst_parser",
|
||||
"sphinx_rtd_theme",
|
||||
"sphinx_design",
|
||||
"sphinx_copybutton",
|
||||
]
|
||||
templates_path = ["_templates"]
|
||||
project = "Zulip"
|
||||
@ -57,6 +58,8 @@ html_theme_options = {
|
||||
}
|
||||
html_logo = "images/zulip-logo.svg"
|
||||
html_static_path = ["_static"]
|
||||
# When copying code blocks, ignore line numbers and prompts
|
||||
copybutton_exclude = ".linenos, .gp"
|
||||
|
||||
|
||||
def setup(app: Any) -> None:
|
||||
|
||||
@ -221,7 +221,8 @@ docs = [
|
||||
"sphinx<8.2", # 8.2.0 requires Python ≥ 3.11
|
||||
"sphinx-rtd-theme",
|
||||
"sphinx-design",
|
||||
|
||||
# Needed for copybutton
|
||||
"sphinx-copybutton",
|
||||
# Needed to build Markdown docs
|
||||
"myst-parser",
|
||||
]
|
||||
|
||||
16
uv.lock
16
uv.lock
@ -4966,6 +4966,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/26/60/1ddff83a56d33aaf6f10ec8ce84b4c007d9368b21008876fceda7e7381ef/sphinx-8.1.3-py3-none-any.whl", hash = "sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2", size = 3487125, upload-time = "2024-10-13T20:27:10.448Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sphinx-copybutton"
|
||||
version = "0.5.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "sphinx" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fc/2b/a964715e7f5295f77509e59309959f4125122d648f86b4fe7d70ca1d882c/sphinx-copybutton-0.5.2.tar.gz", hash = "sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd", size = 23039, upload-time = "2023-04-14T08:10:22.998Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/9e/48/1ea60e74949eecb12cdd6ac43987f9fd331156388dcc2319b45e2ebb81bf/sphinx_copybutton-0.5.2-py3-none-any.whl", hash = "sha256:fb543fd386d917746c9a2c50360c7905b605726b9355cd26e9974857afeae06e", size = 13343, upload-time = "2023-04-14T08:10:20.844Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sphinx-design"
|
||||
version = "0.6.1"
|
||||
@ -6359,6 +6371,7 @@ dev = [
|
||||
{ name = "social-auth-app-django" },
|
||||
{ name = "social-auth-core", extra = ["azuread", "saml"] },
|
||||
{ name = "sphinx" },
|
||||
{ name = "sphinx-copybutton" },
|
||||
{ name = "sphinx-design" },
|
||||
{ name = "sphinx-rtd-theme" },
|
||||
{ name = "sqlalchemy", extra = ["mypy"] },
|
||||
@ -6403,6 +6416,7 @@ dev = [
|
||||
docs = [
|
||||
{ name = "myst-parser" },
|
||||
{ name = "sphinx" },
|
||||
{ name = "sphinx-copybutton" },
|
||||
{ name = "sphinx-design" },
|
||||
{ name = "sphinx-rtd-theme" },
|
||||
]
|
||||
@ -6596,6 +6610,7 @@ dev = [
|
||||
{ name = "social-auth-app-django" },
|
||||
{ name = "social-auth-core", extras = ["azuread", "saml"] },
|
||||
{ name = "sphinx", specifier = "<8.2" },
|
||||
{ name = "sphinx-copybutton" },
|
||||
{ name = "sphinx-design" },
|
||||
{ name = "sphinx-rtd-theme" },
|
||||
{ name = "sqlalchemy", specifier = "==1.4.*" },
|
||||
@ -6641,6 +6656,7 @@ dev = [
|
||||
docs = [
|
||||
{ name = "myst-parser" },
|
||||
{ name = "sphinx", specifier = "<8.2" },
|
||||
{ name = "sphinx-copybutton" },
|
||||
{ name = "sphinx-design" },
|
||||
{ name = "sphinx-rtd-theme" },
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user