Switch the libc documentation site from the alabaster theme to Furo,
which provides mobile-friendly layout, a collapsible sidebar with
caption-based section grouping, and built-in "Edit this page" links.
Changes by area:
conf.py
- Switch html_theme to "furo"
- Add myst_parser extension (already in llvm/docs/requirements.txt, used
by LLDB/Clang/LLVM docs) to allow Markdown alongside RST
- Accept both .rst and .md source suffixes
- Configure Furo source_repository/source_branch/source_directory for
"Edit this page" links pointing to GitHub
- Wire _static/copybutton.{js,css} for copy-to-clipboard buttons on code
blocks (no new pip dependency; can migrate to sphinx-copybutton later
once it's in requirements-hashed.txt)
- Exclude plan-docs.md and Helpers/ from Sphinx processing
index.rst
- Rewrite landing page: remove apologetic "not fully complete" note, add
"What Works Today" section with concrete supported use cases, honest
caveat that full C stdlib coverage is still in progress
- Restructure hidden toctrees into five captioned sidebar groups: "Using
LLVM-libc", "Platforms" (GPU/UEFI promoted to top-level),
"Implementation Status", "Development", "Links"
New files
- docs/_static/copybutton.{js,css}: lightweight copy button for code
blocks
- docs/_static/custom.css: add status badge styles (.badge-complete
etc.) for use with Helpers/Styles.rst substitutions in later phases
Prepare for future status badges:
- docs/Helpers/Styles.rst: RST substitution definitions for status
badges (|Complete|, |Partial|, |InProgress|, |NotStarted|, |GPUOnly|,
|LinuxOnly|) — excluded from toctree, available for Phase 5+ pages
- docs/dev/building_docs.rst: new page covering prerequisites (with
Debian apt-first instructions), CMake flags, ninja docs-libc-html, the
docgen auto-generation pipeline, and troubleshooting
Removed
- docs/README.txt: stale file claiming Sphinx 1.1.3, not in any toctree;
superseded by docs/dev/building_docs.rst
Cleanups
- Remove redundant ".. contents:: Table of Contents" directives from 16
RST files (Furo renders its own per-page TOC in the sidebar)
- Remove same directive from libc/Maintainers.rst (pulled into docs via
include)
57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
// Simple "copy to clipboard" button for code blocks.
|
|
// Adds a button to each <div class="highlight"> block.
|
|
(function () {
|
|
"use strict";
|
|
|
|
function addCopyButton(block) {
|
|
var button = document.createElement("button");
|
|
button.className = "copybutton";
|
|
button.title = "Copy";
|
|
button.setAttribute("aria-label", "Copy code to clipboard");
|
|
button.innerHTML =
|
|
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16">' +
|
|
'<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 ' +
|
|
"0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 " +
|
|
"0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z" +
|
|
'"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 ' +
|
|
"1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 " +
|
|
".138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z" +
|
|
'"/></svg>';
|
|
|
|
button.addEventListener("click", function () {
|
|
var code = block.querySelector("pre").innerText;
|
|
navigator.clipboard.writeText(code).then(
|
|
function () {
|
|
button.classList.add("copied");
|
|
setTimeout(function () {
|
|
button.classList.remove("copied");
|
|
}, 2000);
|
|
},
|
|
function () {
|
|
// Fallback for older browsers
|
|
var ta = document.createElement("textarea");
|
|
ta.value = code;
|
|
ta.style.position = "fixed";
|
|
ta.style.opacity = "0";
|
|
document.body.appendChild(ta);
|
|
ta.focus();
|
|
ta.select();
|
|
document.execCommand("copy");
|
|
document.body.removeChild(ta);
|
|
button.classList.add("copied");
|
|
setTimeout(function () {
|
|
button.classList.remove("copied");
|
|
}, 2000);
|
|
}
|
|
);
|
|
});
|
|
|
|
block.style.position = "relative";
|
|
block.appendChild(button);
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
document.querySelectorAll("div.highlight").forEach(addCopyButton);
|
|
});
|
|
})();
|