Remove href attributes from code line numbers in Docs code blocks (#20286)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-04-22 22:11:41 +02:00 committed by GitHub
parent 93db91437d
commit 4b972df854
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 9 deletions

View File

@ -169,7 +169,7 @@ def update_docs_html():
for html_file in tqdm(SITE.rglob("*.html"), desc="Converting plaintext links", mininterval=1.0):
with open(html_file, encoding="utf-8") as file:
content = file.read()
updated_content = convert_plaintext_links_to_html(content)
updated_content = update_docs_soup(content)
if updated_content != content:
with open(html_file, "w", encoding="utf-8") as file:
file.write(updated_content)
@ -188,8 +188,8 @@ def update_docs_html():
shutil.rmtree(macros_dir)
def convert_plaintext_links_to_html(content: str, max_title_length: int = 70) -> str:
"""Convert plaintext links to HTML hyperlinks and truncate long meta titles."""
def update_docs_soup(content: str, max_title_length: int = 70) -> str:
"""Convert plaintext links to HTML hyperlinks, truncate long meta titles, and remove code line hrefs."""
soup = BeautifulSoup(content, "html.parser")
modified = False
@ -214,6 +214,17 @@ def convert_plaintext_links_to_html(content: str, max_title_length: int = 70) ->
text_node.replace_with(new_soup)
modified = True
# Remove href attributes from code line numbers in code blocks
for a in soup.select('a[href^="#__codelineno-"], a[id^="__codelineno-"]'):
# Remove href if it exists
if a.has_attr("href"):
del a["href"]
modified = True
# Remove name if it exists
if a.has_attr("name"):
del a["name"]
modified = True
return str(soup) if modified else content
@ -349,8 +360,12 @@ def main():
shutil.rmtree(DOCS.parent / "hub_sdk", ignore_errors=True)
shutil.rmtree(DOCS / "repos", ignore_errors=True)
# Show command to serve built website
print('Docs built correctly ✅\nServe site at http://localhost:8000 with "python -m http.server --directory site"')
# Print results
size = sum(f.stat().st_size for f in SITE.rglob("*") if f.is_file()) >> 20
print(
f"Docs built correctly ✅ ({size:.1f} MB)\n"
f'Serve site at http://localhost:8000 with "python -m http.server --directory site"'
)
if __name__ == "__main__":

View File

@ -4,7 +4,7 @@ description: Discover how to enhance Ultralytics YOLO model performance using In
keywords: Ultralytics YOLO, OpenVINO optimization, deep learning, model inference, throughput optimization, latency optimization, AI deployment, Intel's OpenVINO, performance tuning
---
# Optimizing OpenVINO Inference for Ultralytics YOLO Models: A Comprehensive Guide
# OpenVINO Inference Optimization for YOLO
<img width="1024" src="https://github.com/ultralytics/docs/releases/download/0/openvino-ecosystem.avif" alt="OpenVINO Ecosystem">

View File

@ -4,7 +4,7 @@ description: Learn how to create effective Minimum Reproducible Examples (MRE) f
keywords: Ultralytics, YOLO, Minimum Reproducible Example, MRE, bug report, issue resolution, machine learning, deep learning
---
# Creating a Minimum Reproducible Example for Bug Reports in Ultralytics YOLO Repositories
# Creating a Minimal Reproducible Example for Bug Reports
When submitting a bug report for [Ultralytics](https://www.ultralytics.com/) [YOLO](https://github.com/ultralytics) repositories, it's essential to provide a [Minimum Reproducible Example (MRE)](https://stackoverflow.com/help/minimal-reproducible-example). An MRE is a small, self-contained piece of code that demonstrates the problem you're experiencing. Providing an MRE helps maintainers and contributors understand the issue and work on a fix more efficiently. This guide explains how to create an MRE when submitting bug reports to Ultralytics YOLO repositories.
@ -91,7 +91,7 @@ To create an effective Minimum Reproducible Example (MRE) for bug reports in Ult
5. **Format Your Code Properly**: Use code blocks to format your code, making it easier to read.
6. **Test Your MRE**: Ensure your MRE reproduces the issue without modifications.
For a detailed guide, see [Creating a Minimum Reproducible Example](#creating-a-minimum-reproducible-example-for-bug-reports-in-ultralytics-yolo-repositories).
For a detailed guide, see [Creating a Minimum Reproducible Example](#creating-a-minimal-reproducible-example-for-bug-reports).
### Why should I use publicly available models and datasets in my MRE for Ultralytics YOLO bug reports?

View File

@ -4,7 +4,7 @@ description: Learn how to enhance YOLO11 experiment tracking and visualization w
keywords: YOLO11, Weights & Biases, model training, experiment tracking, Ultralytics, machine learning, computer vision, model visualization
---
# Enhancing YOLO11 Experiment Tracking and Visualization with Weights & Biases
# YOLO Experiment Tracking and Visualization with Weights & Biases
[Object detection](https://www.ultralytics.com/glossary/object-detection) models like [Ultralytics YOLO11](https://github.com/ultralytics/ultralytics) have become integral to many [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) applications. However, training, evaluating, and deploying these complex models introduce several challenges. Tracking key training metrics, comparing model variants, analyzing model behavior, and detecting issues require significant instrumentation and experiment management.