pi-studio 0.9.19 → 0.9.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  All notable changes to `pi-studio` are documented here.
4
4
 
5
- ## [Unreleased]
5
+ ## [0.9.21] — 2026-05-28
6
+
7
+ ### Added
8
+ - Added **Recent…** to the Scratchpad so scratchpads saved under previous file/draft identities can be loaded, appended, or copied after reopening Studio or continuing a Pi session.
9
+ - Preview export now distinguishes **Export PDF and Open in Studio preview tab** from **Export PDF and Open in default PDF viewer**; the Studio path opens a Files-view-style editor-only preview tab with a `studio-pdf` block.
10
+ - HTML export now distinguishes **Export HTML and Open in Studio editor** from **Export HTML and Open in browser**; the Studio path opens the exported HTML in an editor-only Studio tab for inspection, editing, previewing, and comment mode.
11
+
12
+ ## [0.9.20] — 2026-05-27
13
+
14
+ ### Added
15
+ - Added an opt-in HTML preview comment mode for editor HTML previews: use **Comment mode** to select text or click elements inside the sandboxed preview, or **Page** for a page-level comment; comments are stored in the existing local Comments rail and can be loaded into a prompt.
16
+ - Added **Refresh** controls to Studio PDF previews and the PDF focus viewer so file-backed PDFs can be reloaded from disk without rerendering the whole Studio pane.
17
+ - Editor-only Studio views now expose the right-pane **Files** and **REPL** views; REPL mode keeps Pi run/critique disabled but allows **Send to REPL** from the editor, including the `Cmd/Ctrl+Shift+Enter` shortcut.
6
18
 
7
19
  ## [0.9.19] — 2026-05-27
8
20
 
package/README.md CHANGED
@@ -19,17 +19,17 @@ Extension for [pi](https://pi.dev) that opens a local two-pane browser workspace
19
19
  ## What it does
20
20
 
21
21
  - Opens a two-pane browser workspace: **Editor** (left) + **Response/Working/Editor Preview** (right)
22
- - Supports one canonical full Studio view per Pi session, plus additional editor-only companion views when you just want extra editing/preview surfaces; the editor toolbar can open a detached copy of the current editor text as a companion view
22
+ - Supports one canonical full Studio view per Pi session, plus additional editor-only companion views when you want extra editing/preview surfaces; editor-only views can also browse files and use the Studio REPL send controls without taking over the full Studio session view
23
23
  - Includes a global **Zen** mode for hiding secondary Studio chrome without changing the current left/right pane layout
24
24
  - Runs editor text directly, asks for structured critique (auto/writing/code focus), offers a manual **Suggest completion** action for short cursor-aware continuations (`Option/Alt+Tab` where available or `Cmd/Ctrl+Shift+Space` from the editor, `Tab` to insert a visible suggestion) with an optional editor-plus-latest-response context mode, or opens **Quiz me** for a Studio-native active-recall loop over the current editor text, selection, current file, folder, or repo, with optional focus guidance for shaping question selection
25
25
  - Includes a live **Working** view for following current model/tool activity, with `All` / `Thinking` / `Tools` filters, image previews for image-producing tool outputs, plus **Load visible into editor** and **Copy visible** actions; when cycling response history, Working follows saved working details for the selected response when available
26
26
  - Includes a right-pane **Files** view for browsing the current Pi session/resource directory, opening folders, loading text/code/CSV/TSV documents into the editor, previewing PDFs/images, opening PDF/image previews in a new Studio tab, converting DOCX/ODT documents to editable Markdown when Pandoc is available after confirmation, copying paths, setting the current folder as the Studio working directory, and revealing files in the file manager
27
27
  - Includes an optional tmux-backed **REPL** view for Shell, Python, IPython, Julia, R, GHCi, and Clojure sessions, with Raw/Literate send modes, `Cmd/Ctrl+Shift+Enter` **Send to REPL**, session start/stop/interrupt controls, a compact refresh-persistent **Studio REPL Record** of user and Pi-sent code, a secondary raw tmux mirror, agent-facing `studio_repl_status` / `studio_repl_send` tools, and Markdown/PDF/HTML export
28
- - Includes a local persistent scratchpad for quick notes you want to keep out of the main editor until you're ready to copy or insert them
28
+ - Includes a local persistent scratchpad for quick notes you want to keep out of the main editor until you're ready to copy or insert them, with a **Recent…** picker for recovering scratchpads saved under earlier file/draft identities
29
29
  - Includes a docked **Outline** rail for navigating document structure in the current editor text, with clickable entries that jump in the raw editor and reveal matching preview locations when available
30
30
  - Restores the current browser-tab editor workspace after refresh and provides an explicit **Reset editor** action when you want to discard the restored draft and return the tab to a fresh blank draft without changing responses or saved files
31
31
  - Turns local preview links, including links inside sandboxed HTML previews, into Studio actions: PDFs open in the embedded viewer, images open in a zoomable focus viewer, PDF/image links can open in a new Studio preview tab, text/code/CSV/TSV document links can open in a new editor tab, DOCX/ODT links can be converted to editable Markdown, and right-click menus provide **Open here**, **Reveal in file manager**, and **Copy path** for local resources
32
- - Includes local comments anchored to selections/lines, shown in a docked **Comments** rail, with transient **Comment** / **Jump** actions from raw-editor selections plus editor-preview selections for Markdown, LaTeX, and code/text/diff previews, alongside optional inline `[an: ...]` toggles when you want comments reflected in the document text
32
+ - Includes local comments anchored to selections/lines, shown in a docked **Comments** rail, with transient **Comment** / **Jump** actions from raw-editor selections plus editor-preview selections for Markdown, LaTeX, code/text/diff previews, and an opt-in comment mode for editor HTML previews; source-anchored comments can be toggled into inline `[an: ...]` annotations when you want comments reflected in the document text
33
33
  - Browses response history (`Prev/Next/Last`) and loads either:
34
34
  - response text
35
35
  - critique notes/full critique
@@ -43,7 +43,7 @@ Extension for [pi](https://pi.dev) that opens a local two-pane browser workspace
43
43
  - Renders straight, unfenced interactive HTML in preview via a sandboxed browser iframe with zoom controls, while fenced `html` blocks remain source code
44
44
  - Embeds local PDFs in Studio Markdown previews via explicit `studio-pdf` fenced blocks, with a Focus action for temporarily enlarging the embedded viewer
45
45
  - Ships optional `pi-studio-dark` and `pi-studio-light` themes tuned for Studio's browser workspace
46
- - Exports right-pane preview as PDF (pandoc + LaTeX) or standalone HTML into the source file directory, Studio working directory, or Pi session directory, preserving authored HTML previews as HTML and rendering CSV/TSV editor previews as tables
46
+ - Exports right-pane preview as PDF (pandoc + LaTeX) or standalone HTML into the source file directory, Studio working directory, or Pi session directory; PDF export can open in a Studio preview tab or the default PDF viewer, and HTML export can open in the default browser or in a new Studio editor tab for inspection/commenting, while preserving authored HTML previews as HTML and rendering CSV/TSV editor previews as tables
47
47
  - Exports local files headlessly via `/studio-pdf <path>` to `<name>.studio.pdf` or `/studio-html <path>` to `<name>.studio.html`; without a path, those commands export the last model response to a timestamped file
48
48
  - Shows model/session/context usage in the footer, plus a compact-context action
49
49
 
@@ -500,6 +500,23 @@
500
500
  return out;
501
501
  }
502
502
 
503
+ const SMART_MARKDOWN_FENCE_CHARS = "`´‘’‚‛“”„‟′‵";
504
+ const SMART_MARKDOWN_FENCE_RE = new RegExp(`^([ \\t]{0,3})([${SMART_MARKDOWN_FENCE_CHARS.replace(/[\\\\\]^-]/g, "\\\\$&")}]{3,})([^${SMART_MARKDOWN_FENCE_CHARS.replace(/[\\\\\]^-]/g, "\\\\$&")}\\r\\n]*)$`);
505
+
506
+ function normalizeMarkdownSmartFences(markdown) {
507
+ return String(markdown || "")
508
+ .replace(/\r\n/g, "\n")
509
+ .split("\n")
510
+ .map(function(line) {
511
+ const match = line.match(SMART_MARKDOWN_FENCE_RE);
512
+ if (!match) return line;
513
+ const run = match[2] || "";
514
+ if (!/[´‘’‚‛“”„‟′‵]/u.test(run)) return line;
515
+ return (match[1] || "") + "`".repeat(Math.max(3, Array.from(run).length)) + (match[3] || "");
516
+ })
517
+ .join("\n");
518
+ }
519
+
503
520
  function transformMarkdownOutsideFences(text, plainTransformer) {
504
521
  const source = String(text || "").replace(/\r\n/g, "\n");
505
522
  if (!source) return source;
@@ -642,11 +659,12 @@
642
659
  }
643
660
 
644
661
  function prepareMarkdownForPandocPreview(markdown, placeholderPrefix) {
662
+ const normalizedMarkdown = normalizeMarkdownSmartFences(markdown);
645
663
  const placeholders = [];
646
664
  const prefix = typeof placeholderPrefix === "string" && placeholderPrefix
647
665
  ? placeholderPrefix
648
666
  : "PISTUDIOANNOT";
649
- const prepared = transformMarkdownOutsideFences(markdown, function(segment) {
667
+ const prepared = transformMarkdownOutsideFences(normalizedMarkdown, function(segment) {
650
668
  return replaceInlineAnnotationMarkers(segment, function(marker) {
651
669
  const label = normalizePreviewAnnotationLabel(marker.body);
652
670
  if (!label) return "";
@@ -663,6 +681,7 @@
663
681
  hasAnnotationMarkers: hasAnnotationMarkers,
664
682
  normalizePreviewAnnotationLabel: normalizePreviewAnnotationLabel,
665
683
  extractStandaloneMarkdownImageCaptionText: extractStandaloneMarkdownImageCaptionText,
684
+ normalizeMarkdownSmartFences: normalizeMarkdownSmartFences,
666
685
  prepareMarkdownForPandocPreview: prepareMarkdownForPandocPreview,
667
686
  readInlineAnnotationMarkerAt: readInlineAnnotationMarkerAt,
668
687
  renderPreviewAnnotationHtml: renderPreviewAnnotationHtml,