@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 154d063b9f
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 06:00 UTC

[doc][mkdocs] Add edit button to documentation (#19637)

Signed-off-by: reidliu41 <reid201711@gmail.com> Co-authored-by: reidliu41 <reid201711@gmail.com>

Reid committed Jun 17, 2025 at 19:10 UTC 154d063b9f97ca47f556a1700d8e0529e505ae56
3 files changed +87
docs/mkdocs/javascript/edit_and_feedback.js new
+47
@@ -0,0 +1,47 @@
1 +/**
2 + * edit_and_feedback.js
3 + *
4 + * Enhances MkDocs Material docs pages by:
5 + *
6 + * 1. Adding a "Question? Give us feedback" link
7 + * below the "Edit" button.
8 + *
9 + * - The link opens a GitHub issue with a template,
10 + * auto-filled with the current page URL and path.
11 + *
12 + * 2. Ensuring the edit button opens in a new tab
13 + * with target="_blank" and rel="noopener".
14 + */
15 +document.addEventListener("DOMContentLoaded", function () {
16 + const url = window.location.href;
17 + const page = document.body.dataset.mdUrl || location.pathname;
18 +
19 + const feedbackLink = document.createElement("a");
20 + feedbackLink.href = `https://github.com/vllm-project/vllm/issues/new?template=100-documentation.yml&title=${encodeURIComponent(
21 + `[Docs] Feedback for \`${page}\``
22 + )}&body=${encodeURIComponent(`📄 **Reference:**\n${url}\n\n📝 **Feedback:**\n_Your response_`)}`;
23 + feedbackLink.target = "_blank";
24 + feedbackLink.rel = "noopener";
25 + feedbackLink.title = "Provide feedback";
26 + feedbackLink.className = "md-content__button";
27 + feedbackLink.innerHTML = `
28 + <svg
29 + xmlns="http://www.w3.org/2000/svg"
30 + height="24px"
31 + viewBox="0 -960 960 960"
32 + width="24px"
33 + fill="currentColor"
34 + >
35 + <path d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/>
36 + </svg>
37 +`;
38 +
39 + const editButton = document.querySelector('.md-content__button[href*="edit"]');
40 +
41 + if (editButton && editButton.parentNode) {
42 + editButton.insertAdjacentElement("beforebegin", feedbackLink);
43 +
44 + editButton.setAttribute("target", "_blank");
45 + editButton.setAttribute("rel", "noopener");
46 + }
47 +});
docs/mkdocs/stylesheets/extra.css
+37
@@ -71,3 +71,40 @@ body[data-md-color-scheme="slate"] .md-nav__item--section > label.md-nav__link .
71 -webkit-mask-image: var(--md-admonition-icon--important);
72 mask-image: var(--md-admonition-icon--important);
73 }
74 +
75 +/* Make label fully visible on hover */
76 +.md-content__button[href*="edit"]:hover::after {
77 + opacity: 1;
78 +}
79 +
80 +/* Hide edit button on generated docs/examples pages */
81 +@media (min-width: 960px) {
82 + .md-content__button[href*="docs/examples/"] {
83 + display: none !important;
84 + }
85 +}
86 +
87 +.md-content__button-wrapper {
88 + position: absolute;
89 + top: 0.6rem;
90 + right: 0.8rem;
91 + display: flex;
92 + flex-direction: row;
93 + align-items: center;
94 + gap: 0.4rem;
95 + z-index: 1;
96 +}
97 +
98 +.md-content__button-wrapper a {
99 + display: inline-flex;
100 + align-items: center;
101 + justify-content: center;
102 + height: 24px;
103 + width: 24px;
104 + color: var(--md-default-fg-color);
105 + text-decoration: none;
106 +}
107 +
108 +.md-content__button-wrapper a:hover {
109 + color: var(--md-accent-fg-color);
110 +}
mkdocs.yaml
+3
@@ -1,6 +1,7 @@
1 site_name: vLLM
2 site_url: https://docs.vllm.ai
3 repo_url: https://github.com/vllm-project/vllm
4 +edit_uri: edit/main/docs/
5 exclude_docs: |
6 *.inc.md
7 *.template.md
@@ -29,6 +30,7 @@ theme:
30 icon: material/brightness-2
31 name: Switch to system preference
32 features:
33 + - content.action.edit
34 - content.code.copy
35 - content.tabs.link
36 - navigation.tracking
@@ -124,6 +126,7 @@ extra_css:
126 extra_javascript:
127 - mkdocs/javascript/run_llm_widget.js
128 - https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
129 + - mkdocs/javascript/edit_and_feedback.js
130
131 # Makes the url format end in .html rather than act as a dir
132 # So index.md generates as index.html and is available under URL /index.html