pi-studio 0.5.48 → 0.5.50
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 +17 -0
- package/README.md +1 -1
- package/client/studio-annotation-helpers.js +66 -0
- package/client/studio-client.js +1477 -47
- package/client/studio.css +9 -5
- package/index.ts +1 -108
- package/package.json +1 -1
- package/shared/studio-markdown-html-comments.js +111 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to `pi-studio` are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.5.50] — 2026-04-09
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Editor-preview comments now also work for minimal structured LaTeX preview content, including headings, prose paragraphs, references sections, and whole display equations.
|
|
11
|
+
- Preview-side selection affordances now include a transient **Jump** action alongside **Comment**, so you can reveal the corresponding raw-editor span without creating a local comment first.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- LaTeX preview comment mapping now follows Studio's rendered structure more closely, including title-block abstracts, loose prose after decorated display equations, bibliography/reference sections, and paragraph alignment around figures and rendered citation/reference text.
|
|
15
|
+
- Preview comment controls for display equations now anchor to the outer rendered equation frame, improving visibility and making preview jump targeting more reliable.
|
|
16
|
+
|
|
17
|
+
## [0.5.49] — 2026-04-09
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Markdown editor-preview comments are now substantially more robust on real pandoc-rendered documents, including smart punctuation and ellipsis normalization, mixed prose plus display-math sections, standalone display equations treated as whole units, MathJax fallback display math, standalone page-break commands, and raw-TeX commands that disappear from preview output.
|
|
21
|
+
- Preview comment block matching now avoids unsafe tiny substring fallbacks, so extra blank-line splits that create short paragraphs like `or` no longer derail later Markdown comment targets.
|
|
22
|
+
- Markdown HTML comments like `<!-- ... -->` are now stripped more consistently across both the main pandoc preview path and plain-markdown fallback rendering, including edge cases after unmatched inline backticks at line breaks.
|
|
23
|
+
|
|
7
24
|
## [0.5.48] — 2026-04-07
|
|
8
25
|
|
|
9
26
|
### Added
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Extension for [pi](https://pi.dev) that opens a local two-pane browser workspace
|
|
|
18
18
|
- Supports one canonical full Studio view per Pi session, plus additional editor-only companion views when you just want extra editing/preview surfaces
|
|
19
19
|
- Runs editor text directly, or asks for structured critique (auto/writing/code focus)
|
|
20
20
|
- 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
|
|
21
|
-
- Includes local comments anchored to selections/lines, shown in a docked **Comments** rail, with **Comment** actions from raw-editor selections plus editor-preview selections for Markdown and code/text/diff previews, alongside optional inline `[an: ...]` toggles when you want comments reflected in the document text
|
|
21
|
+
- Includes local comments anchored to selections/lines, shown in a docked **Comments** rail, with **Comment** actions from raw-editor selections plus editor-preview selections for Markdown, LaTeX, and code/text/diff previews, alongside a transient preview **Jump** action and optional inline `[an: ...]` toggles when you want comments reflected in the document text
|
|
22
22
|
- Browses response history (`Prev/Next/Last`) and loads either:
|
|
23
23
|
- response text
|
|
24
24
|
- critique notes/full critique
|
|
@@ -510,6 +510,71 @@
|
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
+
function stripMarkdownHtmlCommentsInSegment(markdown) {
|
|
514
|
+
const source = String(markdown || "");
|
|
515
|
+
let out = "";
|
|
516
|
+
let index = 0;
|
|
517
|
+
let codeSpanFenceLength = 0;
|
|
518
|
+
let inHtmlComment = false;
|
|
519
|
+
|
|
520
|
+
while (index < source.length) {
|
|
521
|
+
if (inHtmlComment) {
|
|
522
|
+
if (source.startsWith("-->", index)) {
|
|
523
|
+
inHtmlComment = false;
|
|
524
|
+
index += 3;
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
const ch = source[index];
|
|
528
|
+
if (ch === "\n" || ch === "\r") out += ch;
|
|
529
|
+
index += 1;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (codeSpanFenceLength > 0) {
|
|
534
|
+
const fence = "`".repeat(codeSpanFenceLength);
|
|
535
|
+
if (source.startsWith(fence, index)) {
|
|
536
|
+
out += fence;
|
|
537
|
+
index += codeSpanFenceLength;
|
|
538
|
+
codeSpanFenceLength = 0;
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
const ch = source[index];
|
|
542
|
+
out += ch;
|
|
543
|
+
index += 1;
|
|
544
|
+
if (ch === "\n" || ch === "\r") {
|
|
545
|
+
codeSpanFenceLength = 0;
|
|
546
|
+
}
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const backtickMatch = source.slice(index).match(/^`+/);
|
|
551
|
+
if (backtickMatch) {
|
|
552
|
+
const fence = backtickMatch[0] || "`";
|
|
553
|
+
codeSpanFenceLength = fence.length;
|
|
554
|
+
out += fence;
|
|
555
|
+
index += fence.length;
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (source.startsWith("<!--", index)) {
|
|
560
|
+
inHtmlComment = true;
|
|
561
|
+
index += 4;
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
out += source[index];
|
|
566
|
+
index += 1;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
return out;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function stripMarkdownHtmlComments(text) {
|
|
573
|
+
return transformMarkdownOutsideFences(text, function(segment) {
|
|
574
|
+
return stripMarkdownHtmlCommentsInSegment(segment);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
513
578
|
function prepareMarkdownForPandocPreview(markdown, placeholderPrefix) {
|
|
514
579
|
const placeholders = [];
|
|
515
580
|
const prefix = typeof placeholderPrefix === "string" && placeholderPrefix
|
|
@@ -536,6 +601,7 @@
|
|
|
536
601
|
renderPreviewAnnotationHtml: renderPreviewAnnotationHtml,
|
|
537
602
|
replaceInlineAnnotationMarkers: replaceInlineAnnotationMarkers,
|
|
538
603
|
stripAnnotationMarkers: stripAnnotationMarkers,
|
|
604
|
+
stripMarkdownHtmlComments: stripMarkdownHtmlComments,
|
|
539
605
|
transformMarkdownOutsideFences: transformMarkdownOutsideFences,
|
|
540
606
|
});
|
|
541
607
|
|