From b9a6beecc2750eb79e62b6f75d0368ff234ffead Mon Sep 17 00:00:00 2001 From: reidliu41 Date: Tue, 17 Jun 2025 00:26:55 +0800 Subject: [PATCH 1/2] update edit and feedback buttons Signed-off-by: reidliu41 --- docs/mkdocs/javascript/edit_and_feedback.js | 47 +++++++++++++++++++++ docs/mkdocs/stylesheets/extra.css | 37 ++++++++++++++++ mkdocs.yaml | 3 ++ 3 files changed, 87 insertions(+) create mode 100644 docs/mkdocs/javascript/edit_and_feedback.js diff --git a/docs/mkdocs/javascript/edit_and_feedback.js b/docs/mkdocs/javascript/edit_and_feedback.js new file mode 100644 index 000000000000..92a4e3f6db87 --- /dev/null +++ b/docs/mkdocs/javascript/edit_and_feedback.js @@ -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 = "Question? Give us feedback"; + feedbackLink.className = "md-content__button"; + feedbackLink.innerHTML = ` + + + +`; + + 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"); + } +}); diff --git a/docs/mkdocs/stylesheets/extra.css b/docs/mkdocs/stylesheets/extra.css index 6f30d459d5f4..220657f83d5f 100644 --- a/docs/mkdocs/stylesheets/extra.css +++ b/docs/mkdocs/stylesheets/extra.css @@ -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); +} diff --git a/mkdocs.yaml b/mkdocs.yaml index ed05d152f3af..9fb3fed8b8ac 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -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 @@ -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 @@ -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 From a1f1adfb83a84db8960362455e4cdfa371229f69 Mon Sep 17 00:00:00 2001 From: reidliu41 Date: Tue, 17 Jun 2025 06:25:42 +0800 Subject: [PATCH 2/2] update the title Signed-off-by: reidliu41 --- docs/mkdocs/javascript/edit_and_feedback.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mkdocs/javascript/edit_and_feedback.js b/docs/mkdocs/javascript/edit_and_feedback.js index 92a4e3f6db87..68dec725f530 100644 --- a/docs/mkdocs/javascript/edit_and_feedback.js +++ b/docs/mkdocs/javascript/edit_and_feedback.js @@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", function () { )}&body=${encodeURIComponent(`šŸ“„ **Reference:**\n${url}\n\nšŸ“ **Feedback:**\n_Your response_`)}`; feedbackLink.target = "_blank"; feedbackLink.rel = "noopener"; - feedbackLink.title = "Question? Give us feedback"; + feedbackLink.title = "Provide feedback"; feedbackLink.className = "md-content__button"; feedbackLink.innerHTML = `