Skip to content

v0.1.130: Preview pane — Markdown/HTML live, .ipynb viewer, SQL cells; site layout fixes - #42

Merged
singhpratech merged 6 commits into
mainfrom
preview-notebook
Oct 23, 2026
Merged

singhpratech merged 6 commits into
mainfrom
preview-notebook

Conversation

@singhpratech

Copy link
Copy Markdown
Owner

Summary

  • Preview pane beside the editor tabs: View › Preview Pane, Ctrl+Shift+V, or the new Preview toolbar button. Follows the current tab; placeholder on tabs it cannot preview; hidden by default and not saved in the session.
  • Markdown rendered live (Qt GitHub dialect: tables, task lists, fenced code, quotes), theme-aware in Light / Dark / Monokai, relative images resolved against the file.
  • HTML: Lite renders with Qt's rich-text engine; Full renders in WebEngine with JavaScript off, no remote loads, and navigation from the previewed page blocked (meta-refresh, forms, iframes). Relative images and stylesheets beside the file still load.
  • Jupyter .ipynb: the file still opens as JSON; the pane shows a read-only notebook (markdown cells, In [n] code cells, stream / text / HTML / PNG outputs, tracebacks with ANSI stripped). nbformat 4.
  • SQL cells: .sql files split on -- %% run cell by cell through the existing DbConnections::runQuery path on a worker thread, against a temporary scratch SQLite (DuckDB in Full) or any saved connection. Saved connections are read-only until Allow writes is ticked. Ctrl+Return runs the cell under the cursor only while the pane shows a SQL notebook. The AI and MCP SQL gates are untouched.
  • Website: FAQ headings wrapped one word per line (shared card grid assumed an icon column); tables now scroll in wrappers; flavour and release cards fit 390 px; docs/MCP top bars wrap. All five pages verified at 1280 px and 390 px.
  • Adds CLAUDE.md.

Why it is additive

The pane lives in a new inner QSplitter that wraps the tab widget, so the outer splitter keeps its three children (editor group, AI dock host, function list) and the AI-dock sizing, fullscreen and function-list code paths are unchanged. Session save/restore, tab handling and the MCP bridge are not touched. runQuery, the SQL classifier, ai_tools and mcp_bridge are not modified.

Affected platforms

Linux, macOS, Windows. Lite and Full flavours (Full adds the WebEngine HTML renderer and the DuckDB scratch).

Commands run

cmake --build build --target notepatra_all_tests && QT_QPA_PLATFORM=offscreen ctest        # 81/81 (WebEngine + DuckDB tree)
cmake --build build-lite --target notepatra_all_tests && QT_QPA_PLATFORM=offscreen ctest   # 78/78 (true Lite: no WebEngine, no DuckDB)
cmake --build build-full --target notepatra                                                 # Full flavour links and runs
bash scripts/stale-text-check.sh                                                            # 66 passed

Red-state checks: scratch DB switched to :memory: → test_preview_pane fails fast on cross-cell persistence; setSource removed from the tab-switch hook → fails fast on the placeholder section. Both restored.

GUI verified on an isolated Xvfb display with the real binary in Light, Dark and Monokai: Markdown, HTML (Lite engine and WebEngine, relative image loads, page script does not run), notebook with image and traceback, SQL cells run in order with persisted state, placeholder, pane off/on, Ctrl+Return scoping.

Tests

  • test_notebook_render (49 assertions, pure renderers)
  • test_preview_pane (62 assertions, real MainWindow offscreen)
  • Registered suites: 81 Full / 78 Lite (was 79 / 76)

Release

Version bumped to 0.1.130 in CMake, notepatra-mcp/Cargo.toml, Cargo.lock and the .mcpb manifest. Release notes, CHANGELOG, README, docs page and website cards updated. Download-size figures are carried over from v0.1.129 and get corrected by the post-publish size step as usual.

🤖 Generated with Claude Code

Prateek Singh and others added 2 commits October 20, 2026 18:12
Build/test commands, architecture map (Qt app, Rust core via FFI, MCP
sidecar), test-registration rules and the bug-shipping gotchas, pointing
at AGENTS.md and MAINTAINING.md rather than repeating them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…; site layout fixes

A Preview pane beside the editor tabs (View > Preview Pane, Ctrl+Shift+V,
toolbar Preview button). Markdown and HTML render live; .ipynb files show
as read-only notebooks with outputs; .sql files split on -- %% run cell by
cell against a temporary scratch database or any saved connection
(read-only until Allow writes). Full builds render HTML in WebEngine with
scripts, remote loads and navigation disabled.

Additive: the pane lives in a new inner splitter wrapping the tab widget,
so the outer splitter keeps its three children and the AI dock, fullscreen
and function-list code are untouched. Two new suites (test_notebook_render,
test_preview_pane); 81/81 green on Full, 78/78 on Lite.

Website: FAQ headings no longer wrap one word per line (shared card grid
assumed an icon); tables scroll inside wrappers; flavour and release cards
fit phones; docs top bar wraps.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Comment thread src/notebook_render.cpp Fixed
Comment thread src/notebook_render.cpp Fixed
Comment thread src/notebook_render.cpp Fixed
Prateek Singh and others added 4 commits October 20, 2026 18:39
Same behaviour; the for-loop counter was being advanced inside the body,
which CodeQL flags. test_notebook_render still 49/49.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The focus hand-off into the AI dock is asynchronous under offscreen Qt;
the Linux ARM runner needed more than the single 30 ms wait, which made
the vacuity guard fail while every functional assertion passed. Poll up
to 3 s instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With no Ollama reachable the model dropdown reads "(Ollama offline)" and
AIPanel disables the chat input; QWidget::setFocus on a disabled widget is a
no-op, so the vacuity guard in section k could never pass on CI. Fall back to
any enabled, focusable child of the panel. Reproduced and fixed locally with
the test run inside an empty network namespace.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…indows CI)

qtbase v5.15.2's QTextMarkdownImporter marks inline code with
setFont(systemFont(FixedFont)) only; the fixed-pitch flag the preview
renderer keyed on arrived in 5.15.3. Windows CI pins 5.15.2, so inline
code lost its background tint there and test_notebook_render failed
("inline code gets Colors::codeBg") on that platform alone.

isCodeCharFormat() now accepts the fixed-pitch flag OR the system fixed
font family. Four assertions pin it, including a hand-built 5.15.2-shaped
format; flag-only detection turns exactly that one red.

Lite suite 78/78, WebEngine tree preview tests green, stale-text 66/66.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@singhpratech
singhpratech merged commit 73c48f3 into main Oct 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants