Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

api_docs: Add fragment references for all parameters.

Amitsinghyadava72e9476ee2e
diff --git a/static/styles/portico/portico.css b/static/styles/portico/portico.css
index bf0cd496dcb..a28d61eea77 100644
--- a/static/styles/portico/portico.css
+++ b/static/styles/portico/portico.css
@@ -1680,6 +1680,17 @@ label.label-title {
.api-argument {
.api-argument-name {
font-family: monospace;
+
+ .api-argument-hover-link i.fa {
+ opacity: 0;
+ font-size: 0.9em;
+ }
+
+ &:hover .api-argument-hover-link i.fa {
+ opacity: 1;
+ color: hsl(0, 0%, 0%);
+ cursor: pointer;
+ }
}
.api-argument-example-label {
@@ -1692,6 +1703,7 @@ label.label-title {
font-size: 12px;
color: hsl(14, 75%, 60%);
}
+
.api-argument-optional {
text-transform: uppercase;
font-weight: 400;
diff --git a/zerver/lib/markdown/api_arguments_table_generator.py b/zerver/lib/markdown/api_arguments_table_generator.py
index 4c0852755ed..f186a7e6a5f 100644
--- a/zerver/lib/markdown/api_arguments_table_generator.py
+++ b/zerver/lib/markdown/api_arguments_table_generator.py
@@ -91,8 +91,8 @@ class APIArgumentsTablePreprocessor(Preprocessor):
# TODO: Fix naming now that this no longer renders a table.
table = []
argument_template = """
-<div class="api-argument">
- <p class="api-argument-name"><strong>{argument}</strong> {required} {deprecated}</p>
+<div class="api-argument" id="parameter-{argument}">
+ <p class="api-argument-name"><strong>{argument}</strong> {required} {deprecated} <a href="#parameter-{argument}" class="api-argument-hover-link"><i class="fa fa-chain"></i></a></p>
<div class="api-example">
<span class="api-argument-example-label">Example</span>: <code>{example}</code>
</div>