Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

feat: 重定位 headline → Agentic HTML Editor · preview source 改可编辑 + Refresh (#2)

Tom Huang2ae6b9c56c10
diff --git a/README.md b/README.md
index 8a5c1c88..529928c3 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
# HTML Anything
-> **Turn anything into ship-ready HTML, powered by your local AI agent.** Ship-ready = the output is what you actually paste, post, or hand off — no second pass in Figma, no manual re-flow on each platform, no "I'll polish it later". Local-first, zero API key, reuses the CLI session you already have logged in — **8 coding-agent CLIs** auto-detected on your `PATH` (Claude Code · Cursor Agent · Codex · Gemini CLI · GitHub Copilot CLI · OpenCode · Qwen Coder · Aider), driven by **75 composable skill templates** across **9 deliverable surfaces** (magazine articles · keynote decks · résumés · posters · Xiaohongshu cards · tweet cards · web prototypes · data reports · Hyperframes videos). One-click export to WeChat / X / Zhihu, or download `.html` / `.png`.
+> **Markdown is the draft. HTML is what humans read. Your local agent writes it.** The agentic HTML editor — in the agentic era, you don't hand-edit docs anymore, so the output format should be what the reader actually wants: HTML. Local-first, zero API key, reuses the CLI session you already have logged in — **8 coding-agent CLIs** auto-detected on your `PATH` (Claude Code · Cursor Agent · Codex · Gemini CLI · GitHub Copilot CLI · OpenCode · Qwen Coder · Aider), driven by **75 composable skill templates** across **9 deliverable surfaces** (magazine articles · keynote decks · résumés · posters · Xiaohongshu cards · tweet cards · web prototypes · data reports · Hyperframes videos). One-click export to WeChat / X / Zhihu, or download `.html` / `.png`.
<p align="center">
- <img src="docs/assets/banner.png" alt="HTML Anything — turn anything into ship-ready HTML, on your laptop" width="100%" />
+ <img src="docs/assets/banner.png" alt="HTML Anything — the agentic HTML editor, on your laptop" width="100%" />
</p>
<p align="center">
diff --git a/README.zh-CN.md b/README.zh-CN.md
index d1eab9b8..5cce8f8d 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,9 +1,9 @@
# HTML Anything
-> **任何文档 / 数据 → 可交付的 HTML,由你本地的 AI agent 一键完成。** 可交付 = 生成完就是你贴出去、发出去、交出去的样子 —— 不用回 Figma 二修、不用每个平台手动重排、不用 "我先这样、待会再调"。本地优先、零 API Key、复用你已经登录好的 CLI session —— **8 个 coding-agent CLI** 在 `PATH` 上自动识别(Claude Code · Cursor Agent · Codex · Gemini CLI · GitHub Copilot CLI · OpenCode · Qwen Coder · Aider),驱动 **75 套 skill 模板** 和 **9 类可交付场景**(杂志文章 · Keynote PPT · 简历 · 海报 · 小红书 · 推特卡 · Web 原型 · 数据报告 · Hyperframes 视频)。一键复制到公众号 / 推特 / 知乎,或者下载 `.html` / `.png`。
+> **Markdown 是草稿, HTML 才是给人读的成品 —— 让本地 agent 直接写 HTML。** Agent 时代的 HTML 编辑器 —— 既然你已经不亲手改文档、全都让 Claude 改了, 那 agent 的输出就该是读者真正想看的 HTML, 而不是中间态的 markdown。本地优先、零 API Key、复用你已经登录好的 CLI session —— **8 个 coding-agent CLI** 在 `PATH` 上自动识别(Claude Code · Cursor Agent · Codex · Gemini CLI · GitHub Copilot CLI · OpenCode · Qwen Coder · Aider),驱动 **75 套 skill 模板** 和 **9 类可交付场景**(杂志文章 · Keynote PPT · 简历 · 海报 · 小红书 · 推特卡 · Web 原型 · 数据报告 · Hyperframes 视频)。一键复制到公众号 / 推特 / 知乎,或者下载 `.html` / `.png`。
<p align="center">
- <img src="docs/assets/banner.png" alt="HTML Anything — 任何输入 → 可交付 HTML,在你的笔记本上" width="100%" />
+ <img src="docs/assets/banner.png" alt="HTML Anything — agent 时代的 HTML 编辑器,在你的笔记本上" width="100%" />
</p>
<p align="center">
diff --git a/docs/cover.html b/docs/cover.html
index 0dafdfd6..e402804b 100644
--- a/docs/cover.html
+++ b/docs/cover.html
@@ -452,15 +452,15 @@
</div>
<h1 class="headline">
- Anything becomes<br/>
- <em>ship-ready</em> HTML,<br/>
- on your <span class="ul">laptop</span>.
+ Markdown is the draft.<br/>
+ <em>HTML</em> is what humans <span class="ul">read</span>.
</h1>
<p class="lede">
- Markdown is the draft — <b>HTML</b> is what humans read. Your local
- <b>Claude Code</b> (and 7 other agent CLIs) turn <em>anything</em> into a
- single-file, ship-ready HTML — ready to paste into <b>WeChat · X · Zhihu</b>.
+ The <b>agentic HTML editor</b> — in the agentic era, you don't hand-edit
+ docs anymore, so your local <b>Claude Code</b> (and 7 other agent CLIs)
+ should write the format the reader actually wants: <em>HTML</em>, not
+ Markdown. One file, ready to paste into <b>WeChat · X · Zhihu</b>.
</p>
<div class="stats">
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index d723b0b0..830814d9 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -28,13 +28,13 @@ const mono = JetBrains_Mono({
});
export const metadata: Metadata = {
- title: "HTML Anything — turn anything into beautiful HTML, by your local agent",
+ title: "HTML Anything — the agentic HTML editor",
description:
- "Turn any document or dataset into beautiful HTML via your local AI agent: decks, resumes, posters, knowledge cards, Hyperframes videos — one click to WeChat / Twitter / Zhihu.",
+ "Markdown is the draft; HTML is what humans read. Your local AI agent writes HTML directly — decks, resumes, posters, knowledge cards, data reports, Hyperframes videos — one click to WeChat / X / Zhihu.",
metadataBase: new URL("https://html-anything.app"),
openGraph: {
- title: "HTML Anything",
- description: "Anything → beautiful HTML, powered by your local code agent.",
+ title: "HTML Anything — the agentic HTML editor",
+ description: "Markdown is the draft. HTML is what humans read. Your local agent writes it.",
type: "website",
},
};
diff --git a/src/components/preview-pane.tsx b/src/components/preview-pane.tsx
index 8ae4b6e2..f6389a6c 100644
--- a/src/components/preview-pane.tsx
+++ b/src/components/preview-pane.tsx
@@ -47,12 +47,19 @@ export function PreviewPane({
const status = useStore((s) => selectActiveTask(s)?.status ?? "idle");
const log = useStore((s) => selectActiveTask(s)?.log ?? EMPTY_LOG);
const stats = useStore((s) => selectActiveTask(s)?.stats ?? EMPTY_STATS);
+ const activeTaskId = useStore((s) => s.activeTaskId);
+ const setHtmlFor = useStore((s) => s.setHtmlFor);
const [tab, setTab] = useState<PreviewTab>("preview");
const localRef = useRef<HTMLIFrameElement | null>(null);
- const codeRef = useRef<HTMLPreElement | null>(null);
+ const codeRef = useRef<HTMLTextAreaElement | null>(null);
const logRef = useRef<HTMLDivElement | null>(null);
const wrapRef = useRef<HTMLDivElement | null>(null);
const [isFullscreen, setIsFullscreen] = useState(false);
+ // Bumping this remounts the iframe, forcing a clean re-render with the current
+ // HTML — useful when the streaming preview committed a partial render and the
+ // final state didn't repaint, or when injected scripts/styles need to re-init.
+ const [refreshKey, setRefreshKey] = useState(0);
+ const refresh = useCallback(() => setRefreshKey((n) => n + 1), []);
const t = useT();
// Browser-level fullscreen for the whole preview pane. The Deck tab has its
@@ -126,11 +133,12 @@ export function PreviewPane({
if (iframeRef) iframeRef.current = localRef.current;
});
- // Auto-scroll code to bottom while streaming
+ // Auto-scroll code to bottom while streaming. Skip while the user is editing
+ // (textarea is focused) so we don't yank the caret around.
useEffect(() => {
- if (status === "running" && codeRef.current) {
- codeRef.current.scrollTop = codeRef.current.scrollHeight;
- }
+ if (status !== "running" || !codeRef.current) return;
+ if (document.activeElement === codeRef.current) return;
+ codeRef.current.scrollTop = codeRef.current.scrollHeight;
}, [html, status]);
// Auto-scroll log to bottom
@@ -191,6 +199,33 @@ export function PreviewPane({
))}
</div>
<div className="flex items-center gap-1.5">
+ {tab === "preview" && html && (
+ <button
+ onClick={refresh}
+ className="grid h-[22px] w-[22px] place-items-center rounded-full"
+ style={{
+ background: "transparent",
+ color: "var(--ink-soft)",
+ border: "1px solid var(--line)",
+ }}
+ title={t("preview.refreshTooltip")}
+ aria-label={t("preview.refresh")}
+ >
+ <svg
+ width="11"
+ height="11"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <path d="M21 12a9 9 0 1 1-3.46-7.1" />
+ <polyline points="21 3 21 9 15 9" />
+ </svg>
+ </button>
+ )}
{canPresent && (
<button
onClick={toggleFullscreen}
@@ -218,6 +253,7 @@ export function PreviewPane({
{!html && <PreviewPlaceholder status={status} />}
{html && (
<iframe
+ key={refreshKey}
ref={localRef}
title="preview"
srcDoc={display}
@@ -242,22 +278,13 @@ export function PreviewPane({
/>
)}
{tab === "code" && (
- <pre
- ref={codeRef}
- className="h-full overflow-auto p-4 text-[11.5px] leading-relaxed font-[family-name:var(--font-mono)]"
- style={{ background: "#15140f", color: "#e8e4dc" }}
- >
- {html ? (
- <>
- {html}
- {status === "running" && <span className="shimmer">▍</span>}
- </>
- ) : status === "running" ? (
- <span className="text-[#8b8676]">{t("preview.code.waiting")}</span>
- ) : (
- <span className="text-[#8b8676]">{t("preview.code.empty")}</span>
- )}
- </pre>
+ <CodeEditor
+ html={html}
+ status={status}
+ taskId={activeTaskId}
+ setHtmlFor={setHtmlFor}
+ textareaRef={codeRef}
+ />
)}
{tab === "log" && (
<LogPanel logRef={logRef} log={log} />
@@ -361,6 +388,56 @@ function Metric({ label, value, hint, live }: { label: string; value: string; hi
);
}
+function CodeEditor({
+ html,
+ status,
+ taskId,
+ setHtmlFor,
+ textareaRef,
+}: {
+ html: string;
+ status: string;
+ taskId: string;
+ setHtmlFor: (taskId: string, html: string) => void;
+ textareaRef: React.MutableRefObject<HTMLTextAreaElement | null>;
+}) {
+ const t = useT();
+ const isRunning = status === "running";
+ const editable = !isRunning;
+ const placeholder = isRunning ? t("preview.code.waiting") : t("preview.code.empty");
+
+ return (
+ <div className="flex h-full flex-col" style={{ background: "#15140f" }}>
+ <div
+ className="flex items-center justify-between gap-3 px-4 py-1.5 text-[10.5px]"
+ style={{
+ color: editable ? "#9ca28a" : "#8b8676",
+ borderBottom: "1px solid rgba(255,255,255,0.06)",
+ background: "rgba(255,255,255,0.02)",
+ }}
+ >
+ <span>{editable ? t("preview.code.editHint") : t("preview.code.lockedHint")}</span>
+ </div>
+ <textarea
+ ref={textareaRef}
+ value={html}
+ onChange={(e) => setHtmlFor(taskId, e.target.value)}
+ readOnly={!editable}
+ spellCheck={false}
+ placeholder={placeholder}
+ className="flex-1 w-full resize-none overflow-auto p-4 text-[11.5px] leading-relaxed font-[family-name:var(--font-mono)] focus:outline-none"
+ style={{
+ background: "#15140f",
+ color: "#e8e4dc",
+ caretColor: "#ffb55a",
+ border: "none",
+ tabSize: 2,
+ }}
+ />
+ </div>
+ );
+}
+
function LogPanel({
log,
logRef,
diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts
index a7c834e0..7daf5b83 100644
--- a/src/lib/i18n.ts
+++ b/src/lib/i18n.ts
@@ -127,6 +127,8 @@ export interface Dict {
"preview.status.error": string;
"preview.code.waiting": string;
"preview.code.empty": string;
+ "preview.code.editHint": string;
+ "preview.code.lockedHint": string;
"preview.placeholder.runningTitle.part1": string;
"preview.placeholder.runningTitle.accent": string;
"preview.placeholder.idleTitle.part1": string;
@@ -147,6 +149,8 @@ export interface Dict {
"preview.present": string;
"preview.exitPresent": string;
"preview.presentTooltip": string;
+ "preview.refresh": string;
+ "preview.refreshTooltip": string;
// Tasks sidebar
"tasks.heading": string;
@@ -276,7 +280,7 @@ export interface Dict {
}
const en: Dict = {
- "brand.subtitle": "anything → beautiful html",
+ "brand.subtitle": "the agentic HTML editor",
"toolbar.selectAgent": "Select agent",
"toolbar.switchAgent": "Switch agent",
@@ -376,6 +380,8 @@ const en: Dict = {
"preview.status.error": "error",
"preview.code.waiting": "// waiting for the agent's first byte…",
"preview.code.empty": "// no content yet",
+ "preview.code.editHint": "Editable — changes save instantly. Switch to Preview (or hit Refresh) to see them.",
+ "preview.code.lockedHint": "Read-only while the agent is streaming.",
"preview.placeholder.runningTitle.part1": "agent is",
"preview.placeholder.runningTitle.accent": "thinking",
"preview.placeholder.idleTitle.part1": "Paste content on the left, then",
@@ -399,6 +405,8 @@ const en: Dict = {
"preview.present": "⛶ Present",
"preview.exitPresent": "Exit",
"preview.presentTooltip": "Fullscreen preview — F to toggle, ESC to exit",
+ "preview.refresh": "Refresh",
+ "preview.refreshTooltip": "Re-render the preview iframe with the current HTML",
"deck.empty": "No slides found in this output.",
"deck.prev": "Previous slide",
@@ -534,7 +542,7 @@ const en: Dict = {
};
const zhCN: Dict = {
- "brand.subtitle": "anything → beautiful html",
+ "brand.subtitle": "the agentic HTML editor",
"toolbar.selectAgent": "选择 agent",
"toolbar.switchAgent": "切换 agent",
@@ -634,6 +642,8 @@ const zhCN: Dict = {
"preview.status.error": "错误",
"preview.code.waiting": "// 等待 agent 第一个字节…",
"preview.code.empty": "// 还没有内容",
+ "preview.code.editHint": "可编辑 — 改动会即时保存,切到预览 (或点刷新) 即可看到效果。",
+ "preview.code.lockedHint": "Agent 正在流式输出, 暂时只读。",
"preview.placeholder.runningTitle.part1": "agent 正在",
"preview.placeholder.runningTitle.accent": "思考",
"preview.placeholder.idleTitle.part1": "把内容粘到左侧, 然后",
@@ -655,6 +665,8 @@ const zhCN: Dict = {
"preview.present": "⛶ 全屏",
"preview.exitPresent": "退出全屏",
"preview.presentTooltip": "全屏预览 — F 切换 / ESC 退出",
+ "preview.refresh": "刷新",
+ "preview.refreshTooltip": "用当前 HTML 重新渲染预览 iframe",
"deck.empty": "本次结果里没有检测到幻灯片。",
"deck.prev": "上一页",