Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions docs/mkdocs/javascript/edit_and_feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* edit_and_feedback.js
*
* Enhances MkDocs Material docs pages by:
*
* 1. Adding a "Question? Give us feedback" link
* below the "Edit" button.
*
* - The link opens a GitHub issue with a template,
* auto-filled with the current page URL and path.
*
* 2. Ensuring the edit button opens in a new tab
* with target="_blank" and rel="noopener".
*/
document.addEventListener("DOMContentLoaded", function () {
const url = window.location.href;
const page = document.body.dataset.mdUrl || location.pathname;

const feedbackLink = document.createElement("a");
feedbackLink.href = `https://github.com/vllm-project/vllm/issues/new?template=100-documentation.yml&title=${encodeURIComponent(
`[Docs] Feedback for \`${page}\``
)}&body=${encodeURIComponent(`📄 **Reference:**\n${url}\n\n📝 **Feedback:**\n_Your response_`)}`;
feedbackLink.target = "_blank";
feedbackLink.rel = "noopener";
feedbackLink.title = "Provide feedback";
feedbackLink.className = "md-content__button";
feedbackLink.innerHTML = `
<svg
xmlns="http://www.w3.org/2000/svg"
height="24px"
viewBox="0 -960 960 960"
width="24px"
fill="currentColor"
>
<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"/>
</svg>
`;

const editButton = document.querySelector('.md-content__button[href*="edit"]');

if (editButton && editButton.parentNode) {
editButton.insertAdjacentElement("beforebegin", feedbackLink);

editButton.setAttribute("target", "_blank");
editButton.setAttribute("rel", "noopener");
}
});
37 changes: 37 additions & 0 deletions docs/mkdocs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,40 @@ body[data-md-color-scheme="slate"] .md-nav__item--section > label.md-nav__link .
-webkit-mask-image: var(--md-admonition-icon--important);
mask-image: var(--md-admonition-icon--important);
}

/* Make label fully visible on hover */
.md-content__button[href*="edit"]:hover::after {
opacity: 1;
}

/* Hide edit button on generated docs/examples pages */
@media (min-width: 960px) {
.md-content__button[href*="docs/examples/"] {
display: none !important;
}
}

.md-content__button-wrapper {
position: absolute;
top: 0.6rem;
right: 0.8rem;
display: flex;
flex-direction: row;
align-items: center;
gap: 0.4rem;
z-index: 1;
}

.md-content__button-wrapper a {
display: inline-flex;
align-items: center;
justify-content: center;
height: 24px;
width: 24px;
color: var(--md-default-fg-color);
text-decoration: none;
}

.md-content__button-wrapper a:hover {
color: var(--md-accent-fg-color);
}
3 changes: 3 additions & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
site_name: vLLM
site_url: https://docs.vllm.ai
repo_url: https://github.com/vllm-project/vllm
edit_uri: edit/main/docs/
exclude_docs: |
*.inc.md
*.template.md
Expand Down Expand Up @@ -29,6 +30,7 @@ theme:
icon: material/brightness-2
name: Switch to system preference
features:
- content.action.edit
- content.code.copy
- content.tabs.link
- navigation.tracking
Expand Down Expand Up @@ -124,6 +126,7 @@ extra_css:
extra_javascript:
- mkdocs/javascript/run_llm_widget.js
- https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
- mkdocs/javascript/edit_and_feedback.js

# Makes the url format end in .html rather than act as a dir
# So index.md generates as index.html and is available under URL /index.html
Expand Down