The editor view and the published page now use the research-article-template
layout mirrored in frontend/src/styles/template-layout/: one CSS grid with
named lines (screen, page, toc, outset, body, margin) and the 1280+ /
1101-1279 / <=1100 tiers, for both the "article" and "paper" templates.
Published page (backend/src/publisher):
- layout-chrome.ts renders the template markup: centered hero (title,
subtitle, then banner), meta columns (authors, affiliations, published +
reading time + DOI, Resources with PDF/Cite buttons and the links row),
line TOC rail with slim top bar and drawer, paper hero with link pills,
footer without citation/DOI blocks for "paper"
- <main class="tiptap"> is the page grid; wide, full-width and sidenote
wrappers get the template classes, wide embeds get html-embed--wide
- the generated layout runtime replaces the old inline TOC/hash scripts:
heading anchors, scroll-spy, margin sidenote placement, Cite popover,
debug grid on ?grid
- <html data-t…
build: mirror the research-article-template page layout
Add `npm run sync:template-layout` (backend/scripts/sync-template-layout.mjs).
It copies the template's grid tokens and layout stylesheets into
frontend/src/styles/template-layout/ with @custom-media resolved (neither
Vite nor the publisher runs PostCSS), lifts the paper hero styles out of
HeroPaper.astro, copies the link icons, and bundles the layout scripts
(TOC, heading anchors, sidenotes, meta columns, debug grid on ?grid) into
backend/src/publisher/layout-runtime.generated.ts. `--check` reports drift.
Co-authored-by: Cursor <cursoragent@cursor.com>
perf(frontend): load Mermaid, Shiki grammars and language detection on demand
- Mermaid is imported when a diagram renders
- the editor uses shiki/core with the JavaScript regex engine and fetches
each grammar the first time a block needs it; only SHIKI_LANGS ship
- highlight.js language detection loads with the first language-less block
- the chat panel and Embed Studio are lazy components
- shiki-langs.ts holds the shared language/theme constants without a
runtime Shiki import; the publisher keeps the eager highlighter
Entry chunk: 2.79 MB -> 1.60 MB (813 KB -> 492 KB gzip).
Co-authored-by: Cursor <cursoragent@cursor.com>
refactor(shared): move the Markdown renderer and publish types to shared
The renderer is a pure TipTap-JSON walk; living in backend/src/shared lets
the frontend reuse it (the shared folder is the only backend code the
frontend image build copies).
Co-authored-by: Cursor <cursoragent@cursor.com>
20 days ago
feat(mcp): chart and publish tools, structured errors, JSON 404s
- Chart tools for external agents: create_embed (contract validation,
data files, version 1, rendering check), insert_embed (after a block
with expected_rev, caption, also in apply_edits), update_embed (html,
patch or config values, expected_version, Studio draft guard),
restore_embed_version, get_embed, list_embeds, check_embed. Every
write is a version attributed to the agent; session undo and "Undo
its changes" also revert charts.
- publish and get_publish_status run the Publish button's flow (now a
shared publish service): idempotent while a publish runs, absolute
URLs, agent-attributed version. get_article_info states that a Space
hosts a single article.
- Errors carry a stable code and details in structuredContent
(rev_conflict, version_conflict, draft_in_progress, invalid_embed...).
- Unknown /.well-known, /mcp and /api paths answer a JSON 404 instead of
the editor page, so MCP OAuth discovery falls back to the bearer token.
- One headless Chromium job at a…
- Tweak panel: embeds declare 2 to 6 settings in a data-embed-config JSON
block (contract + agent prompt updated, runtime 1.2.0 exposes them as
ctx.config and applies embedConfig messages live). Sliders, colors,
selects, toggles and text update the preview instantly with no model
call and are saved back as "manual tweak" versions.
- Inspect: a point-and-click inspector in the studio preview; the picked
element becomes an @this pointer for the next message, and a label held
by a text setting can be edited without the AI.
- Automatic check after each iteration: POST /api/embed-check renders the
chart in headless Chromium (light/dark, 360/680 px, CDN-only network,
one at a time) with the embed checker, now in src/embed-check, and the
studio shows "N checks passed, 1 warning [Fix]".
- Launcher for new figures (description, CSV drop, 4 gallery starters from
GET /api/embed-starters, existing charts) from the top bar and the slash
menu, instead of opening a random chart.…
feat(embed-studio): error loop, versions, chips and preview controls
- Preview errors reach the agent: a studio-only reporter in the srcdoc
relays uncaught errors, rejections, failed loads and embed:error to the
parent; the studio shows "The chart threw ... [Fix it]" and sends one
automatic fix per user message.
- Versions per agent turn in Y.Map("embed-versions") (shared, capped at
20): vN / Restore / Compare under each reply, Undo last change; restore
appends a copy so history stays linear.
- Starter and follow-up prompt chips, preview width presets (Article,
Wide, 360) and a local light/dark toggle pushed with setTheme.
- The agent's title and source land on the node; Shiki code view with
Copy and Download.
- Provider errors keep their HTTP status; 401/402/429 become actionable
messages with Retry; model name in the header; Done replaces
Save & Close; no more fake "Generating chart..." banner.
- Minimal mobile layout: files drawer and Chat / Preview tabs under 900px.
Co-authored-by: Cursor <cursoragent@cursor.com>
feat(safety): rescue text removed by someone else's change, with real-life scenario tests
Deleting a paragraph in Yjs deletes everything inside it, so an agent
revert, a version restore, a stale tab's delete or offline edits into a
paragraph removed meanwhile silently dropped other people's words.
- The server copies text deleted by someone other than its author into
the doc's "rescued" map (authorship learned per Yjs client from the
authenticated connection and kept in the doc).
- Each tab copies its own text when a remote change removes it, the only
place text typed into an already-deleted paragraph still exists.
- History panel lists removed text with Put back / Copy / Dismiss; the
author gets a banner pointing there.
- tests/scenarios: real server process, browser-equivalent tabs and a
chaos proxy (freeze, offline, server death) covering stale tabs,
deploys, crashes, offline work and bulk removals.
Co-authored-by: Cursor <cursoragent@cursor.com>
feat(embeds): shared Embed.mount runtime, checker, gallery and evals
- Own the embed runtime and authoring guides in embed-kit/ and generate the
runtime and agent skill into backend/src from them.
- Embed Studio prompts and tools target the Embed.mount contract; seed
embeds are migrated to it.
- Add a headless checker (check:embeds), an eval harness with comparison
report, and a gallery of showcase embeds and banners.
Co-authored-by: Cursor <cursoragent@cursor.com>
fix(highlight): auto-detect language for code blocks without explicit lang
Code blocks authored without a language rendered as plain text in both the
editor and the published output (Shiki falls back to "text"). Add a shared
lowlight-based detector and use it as a fallback in the editor decorations
and the publish transformer, so language-less blocks get highlighted
identically everywhere - including in already-written articles.
Co-authored-by: Cursor <cursoragent@cursor.com>
feat(editor): Iframe embed component for remote URLs
Adds a new atomic component `Iframe` (slash menu icon 🔗) that embeds an
arbitrary remote URL via `<iframe src=...>` instead of inlining HTML
from the embed store. Use case: integrating widget Spaces (e.g. carbon-
tokenization-widgets) without having to download and adapt their HTML
to the strict create-html-embed conventions.
- Shared component def (atomic, fields: src, title, desc, height, wide)
- Custom NodeView with live iframe preview, Settings + Reload buttons,
auto-resize when the remote page emits postMessage({type:"embedResize"})
- Publisher transformer emits <figure class="html-embed"> reusing the
existing iframe/figcaption markup so styling and figure numbering
carry over for free
- llms.txt renderer surfaces the URL as a Markdown link
- 3 publisher tests covering happy path, empty-src drop, and wide flag
Co-authored-by: Cursor <cursoragent@cursor.com>
fix(embed): SVG text now follows the iframe theme
Three stacked bugs were keeping the chart text black in dark mode:
1. EmbedStudio mounted both preview iframes with
sandbox="allow-scripts" only (no allow-same-origin). The bootstrap
script couldn't reach window.parent.document, so the cascade fell
through localStorage to matchMedia(prefers-color-scheme) - which
returns the OS preference, not the app theme. Result: the iframe
could land on a different theme than the article. Aligned the
sandbox with HtmlEmbedView ("allow-scripts allow-same-origin").
2. The THEME_BOOTSTRAP in shared/embed-doc.ts always overwrote the
srcdoc-provided data-theme attribute, even when every detection
path failed. Honour the existing data-theme before falling back
to matchMedia so an explicit isDark from buildEmbedSrcdoc wins.
3. SVG text/line/path don't inherit CSS color the way HTML elements
do - their default fill/stroke is "black", not "currentColor".
Charts that scoped colours via `body { color: var(--text-color) }`
…
fix(ui,publisher): kill theme/color flickers and translation prompts
- Published page and its banner iframe now inline a synchronous theme
bootstrap in <head>, so the first paint already uses the correct
data-theme (no dark -> light flicker on navigation).
- <meta name="google|robots" content="notranslate"> on both the
editor (frontend/index.html) and the published article so Chrome
stops proposing to translate the page to French.
- CollaborationCursorV3: silence a peer's caret + label (via the
.collaboration-cursor--silenced class) when that same peer also
broadcasts an agentFocus. Fixes the duplicate "<Name>" + "<Name>
agent" labels that stacked while a chat action was active.
- Embed Studio preview container pinned to --page-bg and the iframe
element forced to background: transparent + color-scheme: light
dark, so the preview tracks dark mode instead of falling through
to the browser's default white.
- App.tsx primaryHue sync: when the Yjs settings map has no
primaryHue (fresh state or after reset-article), drop the inline
--p…
- Split html-renderer post-processing into per-feature transformers (accordion, bibliography,
citation, footnote, highlight-code, html-embed, mermaid) with a shared types contract
- Extract embed iframe srcdoc builder, shiki config and theme resolver into backend/src/shared
so the frontend can reuse the exact same palette and embed chrome
- Keep the renderer entrypoint (index.ts) as an orchestrator and trim the legacy logic to the
new querySelector-based scope selection (simpler + covered by updated snapshot)
- Update publisher/css-resolution/security suites + snapshot to the new output
Made-with: Cursor
Phase 1 - Publisher pipeline:
- Extract ~370 lines of inline CSS from html-renderer.ts into _publisher.css
- Create shared/component-defs.ts as single source of truth for component definitions
- Replace 6 regex blocks in postProcess() with linkedom DOM manipulation
- Add GET /api/preview/:docName for testing renders without publishing
- Add 12 snapshot tests for each postProcess transformation (46 tests total)
Phase 2 - Remove MUI:
- Replace all MUI components with native HTML elements + custom CSS
- Create _ui.css with editor chrome styles using --ed-* CSS tokens
- Create Tooltip.tsx using Floating UI (lightweight replacement)
- Replace @mui/icons-material with lucide-react
- Delete theme.ts, remove @mui/* and @emotion/* dependencies
Phase 3 - Documentation:
- Add docs/ARCHITECTURE.md covering CSS layers, HF Spaces constraints,
shared registry, publisher pipeline, and test coverage
Made-with: Cursor