-
Notifications
You must be signed in to change notification settings - Fork 0
polish(nav): proper sidebar labels for SDK package groups #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,6 +205,30 @@ jobs: | |
| # (`resq-dsa`); convert with `-` → `_` to look them up. | ||
| rustdoc_md_dir = pathlib.Path("target") / "doc-md" | ||
|
|
||
| # Smart sidebar-label formatting (mirrors the splice | ||
| # step's helper) so leaf stub pages also read with proper | ||
| # acronyms and brand casing. | ||
| ACRONYMS = { | ||
| "ai", "cli", "dsa", "tui", "api", "sdk", "ui", "mcp", | ||
| "ipfs", "grpc", "http", "url", "json", "yaml", "xml", | ||
| "sql", "css", "html", "io", | ||
| } | ||
| BRAND = {"resq": "ResQ"} | ||
|
|
||
| def label_for(name: str) -> str: | ||
| if "." in name: | ||
| return name | ||
| out = [] | ||
| for part in name.split("-"): | ||
| lower = part.lower() | ||
| if lower in BRAND: | ||
| out.append(BRAND[lower]) | ||
| elif lower in ACRONYMS: | ||
| out.append(part.upper()) | ||
| else: | ||
| out.append(part.capitalize()) | ||
| return " ".join(out) | ||
|
Comment on lines
+218
to
+230
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
def label_for(name: str) -> str:
# Pass through names that already have mixed casing (e.g. .NET namespaces)
if "." in name and not name.islower():
return name
out = []
# Handle both hyphens and underscores for consistent spacing
for part in name.replace("_", "-").split("-"):
lower = part.lower()
if lower in BRAND:
out.append(BRAND[lower])
elif lower in ACRONYMS:
out.append(part.upper())
else:
out.append(part.capitalize())
return " ".join(out) |
||
|
|
||
| def banner_for(meta: dict) -> str: | ||
| docs_rs_url = f"https://docs.rs/{meta['name']}/{meta['version']}" | ||
| crates_io_url = f"https://crates.io/crates/{meta['name']}" | ||
|
|
@@ -252,7 +276,15 @@ jobs: | |
| docs_rs_url = f"https://docs.rs/{meta['name']}/{meta['version']}" | ||
| crates_io_url = f"https://crates.io/crates/{meta['name']}" | ||
|
|
||
| # Frontmatter sidebarTitle gives the leaf a clean | ||
| # display label like "ResQ Clean" / "ResQ Deploy" so | ||
| # binary-only stubs match the style of library | ||
| # crates' rustdoc groups in the sidebar. | ||
| parts = [ | ||
| "---", | ||
| f"sidebarTitle: '{label_for(meta['name'])}'", | ||
| "---", | ||
| "", | ||
| f"# {meta['name']}", | ||
| "", | ||
| f"> **Version:** `v{meta['version']}` · " | ||
|
|
@@ -549,6 +581,35 @@ jobs: | |
| parts = p.split("/") | ||
| insert_file(tree, parts, full_id) | ||
|
|
||
| # Smart group-label formatting so the sidebar reads | ||
| # "ResQ DSA" / "ResQ CLI" instead of the raw "resq-dsa" / | ||
| # "resq-cli" dir names. Acronyms upper-cased; the brand | ||
| # "ResQ" preserved with its mixed case; everything else | ||
| # title-cased. Result matches the brand voice and is | ||
| # consistent across all language sub-groups. | ||
| ACRONYMS = { | ||
| "ai", "cli", "dsa", "tui", "api", "sdk", "ui", "mcp", | ||
| "ipfs", "grpc", "http", "url", "json", "yaml", "xml", | ||
| "sql", "css", "html", "io", | ||
| } | ||
| BRAND = {"resq": "ResQ"} | ||
|
|
||
| def label_for(name): | ||
| # Pass dotted names through (e.g. .NET-style | ||
| # `ResQ.Blockchain` already carry canonical casing). | ||
| if "." in name: | ||
| return name | ||
| out = [] | ||
| for part in name.split("-"): | ||
| lower = part.lower() | ||
| if lower in BRAND: | ||
| out.append(BRAND[lower]) | ||
| elif lower in ACRONYMS: | ||
| out.append(part.upper()) | ||
| else: | ||
| out.append(part.capitalize()) | ||
| return " ".join(out) | ||
|
Comment on lines
+590
to
+611
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is a duplicate of the |
||
|
|
||
| def to_mintlify(node, group_name): | ||
| pages = [] | ||
| if "_landing" in node: | ||
|
|
@@ -557,7 +618,9 @@ jobs: | |
| pages.append(full_id) | ||
| for dname, sub in sorted(node.get("_dirs", {}).items()): | ||
| pages.append(to_mintlify(sub, dname)) | ||
| return pages if group_name is None else {"group": group_name, "pages": pages} | ||
| if group_name is None: | ||
| return pages | ||
| return {"group": label_for(group_name), "pages": pages} | ||
|
|
||
| new_pages = [f"{PREFIX}/README"] + to_mintlify(tree, None) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
ACRONYMSlist is missing several project-specific and common technical acronyms that appear in the documentation (e.g.,HCE,PDIE,DTSOP,RPC). Adding these will ensure they are correctly capitalized in the sidebar, matching the "polish" goal of this PR.