From 6bebeb9afa9dcaa9f4ff445783a8809932803957 Mon Sep 17 00:00:00 2001 From: Chenhan Yu Date: Mon, 13 Jul 2026 13:46:05 -0700 Subject: [PATCH 01/12] docs: add announcements landing page Signed-off-by: Chenhan Yu --- docs/build_site.py | 340 +++++++++++++++ .../posts/2026-06-29-dspark-vs-domino.md | 222 ++++++++++ .../2026-07-13-github-pages-announcements.md | 34 ++ docs/site_src/static/css/blog.css | 401 ++++++++++++++++++ docs/site_src/static/js/blog.js | 57 +++ docs/site_src/tools/domino_fig.png | Bin 0 -> 178776 bytes .../tools/dspark_domino_al_qwen3_8b.png | Bin 0 -> 156764 bytes docs/site_src/tools/dspark_fig1.png | Bin 0 -> 111538 bytes docs/site_src/tools/dspark_fig7.png | Bin 0 -> 130179 bytes noxfile.py | 3 +- 10 files changed, 1056 insertions(+), 1 deletion(-) create mode 100644 docs/build_site.py create mode 100644 docs/site_src/posts/2026-06-29-dspark-vs-domino.md create mode 100644 docs/site_src/posts/2026-07-13-github-pages-announcements.md create mode 100644 docs/site_src/static/css/blog.css create mode 100644 docs/site_src/static/js/blog.js create mode 100644 docs/site_src/tools/domino_fig.png create mode 100644 docs/site_src/tools/dspark_domino_al_qwen3_8b.png create mode 100644 docs/site_src/tools/dspark_fig1.png create mode 100644 docs/site_src/tools/dspark_fig7.png diff --git a/docs/build_site.py b/docs/build_site.py new file mode 100644 index 00000000000..7cba6dcd92b --- /dev/null +++ b/docs/build_site.py @@ -0,0 +1,340 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Build the public Model Optimizer announcement site.""" + +from __future__ import annotations + +import argparse +import html +import json +import re +import shutil +from pathlib import Path + +import yaml + + +ROOT = Path(__file__).resolve().parent +SITE_SRC = ROOT / "site_src" +POSTS_DIR = SITE_SRC / "posts" +STATIC_DIR = SITE_SRC / "static" +TOOLS_DIR = SITE_SRC / "tools" +SOURCE_ASSETS = ROOT / "source" / "assets" + + +def parse_frontmatter(text: str) -> tuple[dict, str]: + if not text.startswith("---"): + return {}, text + end = text.find("\n---", 3) + if end < 0: + return {}, text + metadata = yaml.safe_load(text[3:end]) or {} + return metadata, text[end + 4 :].strip() + + +def slug_from_path(path: Path) -> str: + slug = path.stem + match = re.match(r"\d{4}-\d{2}-\d{2}-(.*)", slug) + return match.group(1) if match else slug + + +def inline_markup(text: str) -> str: + escaped = html.escape(text) + escaped = re.sub(r"`([^`]+)`", r"\1", escaped) + escaped = re.sub(r"\*\*([^*]+)\*\*", r"\1", escaped) + escaped = re.sub(r"\[([^\]]+)\]\(([^)]+)\)", r'\1', escaped) + return escaped + + +def page_path(path: str, prefix: str) -> str: + if not path or "://" in path or path.startswith("#") or path.startswith("mailto:"): + return path + if path.startswith("/"): + return prefix + path.lstrip("/") + return path + + +def render_markdown(markdown: str, prefix: str) -> str: + lines = markdown.splitlines() + out: list[str] = [] + paragraph: list[str] = [] + list_open = False + code_open = False + code_lines: list[str] = [] + + def flush_paragraph() -> None: + nonlocal paragraph + if paragraph: + out.append(f"

{inline_markup(' '.join(paragraph))}

") + paragraph = [] + + def close_list() -> None: + nonlocal list_open + if list_open: + out.append("") + list_open = False + + for raw in lines: + line = raw.rstrip() + stripped = line.strip() + if stripped.startswith("```"): + flush_paragraph() + close_list() + if code_open: + out.append(f"
{html.escape(chr(10).join(code_lines))}
") + code_lines = [] + code_open = False + else: + code_open = True + continue + if code_open: + code_lines.append(raw) + continue + if not stripped: + flush_paragraph() + close_list() + continue + if stripped.startswith("<") and stripped.endswith(">"): + flush_paragraph() + close_list() + out.append(re.sub(r'(src|href)="(/[^"]*)"', lambda m: f'{m.group(1)}="{page_path(m.group(2), prefix)}"', stripped)) + continue + if stripped.startswith("### "): + flush_paragraph() + close_list() + out.append(f"

{inline_markup(stripped[4:])}

") + continue + if stripped.startswith("## "): + flush_paragraph() + close_list() + out.append(f"

{inline_markup(stripped[3:])}

") + continue + image = re.match(r"!\[([^\]]*)\]\(([^)]+)\)", stripped) + if image: + flush_paragraph() + close_list() + alt, src = image.groups() + src = page_path(src, prefix) + out.append( + '
' + f'{html.escape(alt, quote=True)}' + f"
{inline_markup(alt)}
" + "
" + ) + continue + if stripped.startswith("- "): + flush_paragraph() + if not list_open: + out.append("") - list_open = False - - for raw in lines: - line = raw.rstrip() - stripped = line.strip() - if stripped.startswith("```"): - flush_paragraph() - close_list() - if code_open: - out.append(f"
{html.escape(chr(10).join(code_lines))}
") - code_lines = [] - code_open = False - else: - code_open = True - continue - if code_open: - code_lines.append(raw) - continue - if not stripped: - flush_paragraph() - close_list() - continue - if stripped.startswith("<") and stripped.endswith(">"): - flush_paragraph() - close_list() - out.append(re.sub(r'(src|href)="(/[^"]*)"', lambda m: f'{m.group(1)}="{page_path(m.group(2), prefix)}"', stripped)) - continue - if stripped.startswith("### "): - flush_paragraph() - close_list() - out.append(f"

{inline_markup(stripped[4:])}

") - continue - if stripped.startswith("## "): - flush_paragraph() - close_list() - out.append(f"

{inline_markup(stripped[3:])}

") - continue - image = re.match(r"!\[([^\]]*)\]\(([^)]+)\)", stripped) - if image: - flush_paragraph() - close_list() - alt, src = image.groups() - src = page_path(src, prefix) - out.append( - '
' - f'{html.escape(alt, quote=True)}' - f"
{inline_markup(alt)}
" - "
" - ) - continue - if stripped.startswith("- "): - flush_paragraph() - if not list_open: - out.append("