Skip to content

TsukiNi22/ai-utils / skills/docs/better-html-style

better-html-style

Verified

FileKindSize
SKILL.mdskill md7.3 KB
requires.txtmarkdown11 B
scripts/new_page.pyexecutablescript2.9 KB
templates/search.htmlother417 B
templates/site.cssother11.3 KB
templates/site.jsscript12.5 KB

scripts/new_page.py

View on GitHub
#!/usr/bin/env python3
"""
Build one self-contained page in the better-html-style: the html-style page (style.css + base.js) with the site layer of this
skill (templates/site.css + site.js) and the search box in the top bar - with no site index, it searches the sections of the
page itself (typo tolerant, / or Ctrl+K). A body without a sidebar gets the whole column (.layout.wide), never the one of the sidebar.

Usage:
    new_page.py <body.html> -o <out.html> [--css extra.css ...] [--js extra.js ...] [--actions actions.html] [--no-search]
                [--lang-switch] [--attr NAME=VALUE ...] [--set KEY=VALUE ...] [--force]

Every option but --no-search goes to html-style/scripts/new_page.py (a sibling skill: ../html-style).
"""

import argparse
import re
import subprocess
import sys
import tempfile
from pathlib import Path

SKILL = Path(__file__).resolve().parent.parent
HTML_STYLE = SKILL.parent / "html-style" / "scripts" / "new_page.py"

def main() -> int:
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("body")
    ap.add_argument("-o", "--out", required=True)
    ap.add_argument("--css", nargs="*", default=[])
    ap.add_argument("--js", nargs="*", default=[])
    ap.add_argument("--actions", default="")
    ap.add_argument("--no-search", action="store_true", help="no search box in the top bar")
    ap.add_argument("--lang-switch", action="store_true")
    ap.add_argument("--attr", nargs="*", default=[], metavar="NAME=VALUE")
    ap.add_argument("--set", nargs="*", default=[], metavar="KEY=VALUE")
    ap.add_argument("--force", action="store_true")
    a = ap.parse_args()
    if not HTML_STYLE.exists():
        sys.exit("Error: the html-style skill is missing (%s): install it next to this one" % HTML_STYLE)
    actions = "" if a.no_search else (SKILL / "templates" / "search.html").read_text(encoding="utf-8")
    if a.actions:
        actions += Path(a.actions).read_text(encoding="utf-8")
    with tempfile.NamedTemporaryFile("w", suffix=".html", delete=False, encoding="utf-8") as tmp:
        tmp.write(actions)
    cmd = [sys.executable, str(HTML_STYLE), a.body, "-o", a.out, "--css", str(SKILL / "templates" / "site.css"), *a.css,
           "--js", str(SKILL / "templates" / "site.js"), *a.js, "--actions", tmp.name]
    if a.lang_switch:
        cmd.append("--lang-switch")
    if a.force:
        cmd.append("--force")
    if a.attr:
        cmd += ["--attr", *a.attr]
    if a.set:
        cmd += ["--set", *a.set]
    try:
        code = subprocess.run(cmd).returncode
    finally:
        Path(tmp.name).unlink()
    if code == 0 and not re.search(r"<aside\b[^>]*\bclass=[\"'][^\"']*\bsidebar\b", Path(a.body).read_text(encoding="utf-8")):
        out = Path(a.out)
        out.write_text(out.read_text(encoding="utf-8").replace('<div class="layout" id="top">', '<div class="layout wide" id="top">', 1), encoding="utf-8")
    return code

if __name__ == "__main__":
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall