pi-studio 0.5.40 → 0.5.41

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/index.ts +74 -11
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.41] — 2026-03-30
8
+
9
+ ### Changed
10
+ - `/studio-pdf` PDF callouts now render with a slightly stronger visual treatment in exported PDFs, including per-kind colours and a more obvious title badge, while staying page-break-friendly.
11
+
12
+ ### Fixed
13
+ - `/studio-pdf` fenced Quarto-style callouts that end with lists now keep their marker paragraphs separate during Pandoc processing, avoiding malformed LaTeX such as callouts closing inside the final list item.
14
+
7
15
  ## [0.5.40] — 2026-03-30
8
16
 
9
17
  ### Changed
package/index.ts CHANGED
@@ -257,13 +257,28 @@ function buildStudioPdfPreamble(options?: StudioPdfRenderOptions): string {
257
257
  \\definecolor{StudioDiffDelText}{HTML}{CF222E}
258
258
  \\definecolor{StudioDiffMetaText}{HTML}{57606A}
259
259
  \\definecolor{StudioDiffHunkText}{HTML}{0969DA}
260
+ \\definecolor{StudioCalloutNoteBorder}{HTML}{2F6FEB}
261
+ \\definecolor{StudioCalloutNoteText}{HTML}{1F4B99}
262
+ \\definecolor{StudioCalloutNoteLabelBg}{HTML}{EAF2FF}
263
+ \\definecolor{StudioCalloutTipBorder}{HTML}{1A7F37}
264
+ \\definecolor{StudioCalloutTipText}{HTML}{175C2C}
265
+ \\definecolor{StudioCalloutTipLabelBg}{HTML}{EAF7EE}
266
+ \\definecolor{StudioCalloutWarningBorder}{HTML}{B76E00}
267
+ \\definecolor{StudioCalloutWarningText}{HTML}{8A5300}
268
+ \\definecolor{StudioCalloutWarningLabelBg}{HTML}{FFF3D6}
269
+ \\definecolor{StudioCalloutImportantBorder}{HTML}{CF222E}
270
+ \\definecolor{StudioCalloutImportantText}{HTML}{A40E26}
271
+ \\definecolor{StudioCalloutImportantLabelBg}{HTML}{FDEBEC}
272
+ \\definecolor{StudioCalloutCautionBorder}{HTML}{CF222E}
273
+ \\definecolor{StudioCalloutCautionText}{HTML}{A40E26}
274
+ \\definecolor{StudioCalloutCautionLabelBg}{HTML}{FDEBEC}
260
275
  \\newcommand{\\studioannotation}[1]{\\begingroup\\setlength{\\fboxsep}{1.5pt}\\fcolorbox{StudioAnnotationBorder}{StudioAnnotationBg}{\\begin{varwidth}{\\dimexpr\\linewidth-2\\fboxsep-2\\fboxrule\\relax}\\raggedright\\textcolor{StudioAnnotationText}{\\sffamily\\footnotesize\\strut #1}\\end{varwidth}}\\endgroup}
261
276
  \\newcommand{\\StudioDiffAddTok}[1]{\\textcolor{StudioDiffAddText}{#1}}
262
277
  \\newcommand{\\StudioDiffDelTok}[1]{\\textcolor{StudioDiffDelText}{#1}}
263
278
  \\newcommand{\\StudioDiffMetaTok}[1]{\\textcolor{StudioDiffMetaText}{#1}}
264
279
  \\newcommand{\\StudioDiffHunkTok}[1]{\\textcolor{StudioDiffHunkText}{#1}}
265
280
  \\newcommand{\\StudioDiffHeaderTok}[1]{\\textcolor{StudioDiffHunkText}{\\textbf{#1}}}
266
- \\newenvironment{studiocallout}[1]{\\par\\vspace{0.22em}\\noindent\\begingroup\\color{StudioAnnotationBorder}\\hrule height 0.45pt\\color{black}\\vspace{0.08em}\\noindent{\\sffamily\\bfseries\\textcolor{StudioAnnotationText}{#1}}\\par\\vspace{0.02em}\\leftskip=0.7em\\rightskip=0pt\\parindent=0pt\\parskip=0.15em}{\\par\\vspace{0.02em}\\noindent\\color{StudioAnnotationBorder}\\hrule height 0.45pt\\par\\endgroup\\vspace{0.22em}}
281
+ \\newenvironment{studiocallout}[4]{\\par\\vspace{0.6em}\\noindent\\begingroup\\def\\StudioCalloutBorder{#2}\\def\\StudioCalloutText{#3}\\def\\StudioCalloutLabelBg{#4}\\color{\\StudioCalloutBorder}\\hrule height 0.8pt\\relax\\vspace{0.32em}\\noindent\\colorbox{\\StudioCalloutLabelBg}{\\strut\\hspace{0.55em}{\\sffamily\\bfseries\\footnotesize\\textcolor{\\StudioCalloutText}{#1}}\\hspace{0.55em}}\\par\\vspace{0.24em}\\normalcolor\\leftskip=0.9em\\rightskip=0pt\\parindent=0pt\\parskip=0.18em}{\\par\\vspace{0.12em}\\noindent\\color{\\StudioCalloutBorder}\\hrule height 0.55pt\\par\\endgroup\\vspace{0.5em}}
267
282
  \\usepackage{caption}
268
283
  \\captionsetup[figure]{justification=raggedright,singlelinecheck=false}
269
284
  \\usepackage{enumitem}
@@ -3405,9 +3420,19 @@ function preprocessStudioMarkdownCalloutsForPdf(markdown: string): { markdown: s
3405
3420
  content: contentLines.join("\n").trim(),
3406
3421
  };
3407
3422
  blocks.push(block);
3423
+ // Keep markers on their own paragraphs so pandoc does not absorb them
3424
+ // into neighbouring list items or paragraphs. Without these blank
3425
+ // lines, the end marker for a callout that finishes with a list can be
3426
+ // emitted inside the final \item, which then produces malformed LaTeX
3427
+ // when we later replace the marker range with a custom callout
3428
+ // environment.
3429
+ out.push("");
3408
3430
  out.push(`PISTUDIOPDFCALLOUTSTART${block.kind.toUpperCase()}${block.markerId}`);
3431
+ out.push("");
3409
3432
  if (block.content) out.push(block.content);
3433
+ out.push("");
3410
3434
  out.push(`PISTUDIOPDFCALLOUTEND${block.kind.toUpperCase()}${block.markerId}`);
3435
+ out.push("");
3411
3436
  i = j;
3412
3437
  }
3413
3438
 
@@ -3480,6 +3505,52 @@ function preprocessStudioMarkdownImageAlignmentForPdf(markdown: string): { markd
3480
3505
  return { markdown: out.join("\n"), blocks };
3481
3506
  }
3482
3507
 
3508
+ function getStudioPdfCalloutStyle(kind: StudioPdfMarkdownCalloutBlock["kind"]): {
3509
+ label: string;
3510
+ borderColor: string;
3511
+ textColor: string;
3512
+ labelBgColor: string;
3513
+ } {
3514
+ switch (kind) {
3515
+ case "note":
3516
+ return {
3517
+ label: "Note",
3518
+ borderColor: "StudioCalloutNoteBorder",
3519
+ textColor: "StudioCalloutNoteText",
3520
+ labelBgColor: "StudioCalloutNoteLabelBg",
3521
+ };
3522
+ case "tip":
3523
+ return {
3524
+ label: "Tip",
3525
+ borderColor: "StudioCalloutTipBorder",
3526
+ textColor: "StudioCalloutTipText",
3527
+ labelBgColor: "StudioCalloutTipLabelBg",
3528
+ };
3529
+ case "warning":
3530
+ return {
3531
+ label: "Warning",
3532
+ borderColor: "StudioCalloutWarningBorder",
3533
+ textColor: "StudioCalloutWarningText",
3534
+ labelBgColor: "StudioCalloutWarningLabelBg",
3535
+ };
3536
+ case "important":
3537
+ return {
3538
+ label: "Important",
3539
+ borderColor: "StudioCalloutImportantBorder",
3540
+ textColor: "StudioCalloutImportantText",
3541
+ labelBgColor: "StudioCalloutImportantLabelBg",
3542
+ };
3543
+ case "caution":
3544
+ default:
3545
+ return {
3546
+ label: "Caution",
3547
+ borderColor: "StudioCalloutCautionBorder",
3548
+ textColor: "StudioCalloutCautionText",
3549
+ labelBgColor: "StudioCalloutCautionLabelBg",
3550
+ };
3551
+ }
3552
+ }
3553
+
3483
3554
  function replaceStudioPdfCalloutBlocksInGeneratedLatex(
3484
3555
  latex: string,
3485
3556
  blocks: StudioPdfMarkdownCalloutBlock[],
@@ -3494,16 +3565,8 @@ function replaceStudioPdfCalloutBlocksInGeneratedLatex(
3494
3565
  const endIndex = transformed.indexOf(endMarker, startIndex + startMarker.length);
3495
3566
  if (endIndex < 0) continue;
3496
3567
  const inner = transformed.slice(startIndex + startMarker.length, endIndex).trim();
3497
- const label = block.kind === "note"
3498
- ? "Note"
3499
- : block.kind === "tip"
3500
- ? "Tip"
3501
- : block.kind === "warning"
3502
- ? "Warning"
3503
- : block.kind === "important"
3504
- ? "Important"
3505
- : "Caution";
3506
- const replacement = `\\begin{studiocallout}{${label}}\n${inner}\n\\end{studiocallout}`;
3568
+ const style = getStudioPdfCalloutStyle(block.kind);
3569
+ const replacement = `\\begin{studiocallout}{${style.label}}{${style.borderColor}}{${style.textColor}}{${style.labelBgColor}}\n${inner}\n\\end{studiocallout}`;
3507
3570
  transformed = transformed.slice(0, startIndex) + replacement + transformed.slice(endIndex + endMarker.length);
3508
3571
  }
3509
3572
  return transformed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.5.40",
3
+ "version": "0.5.41",
4
4
  "description": "Two-pane browser workspace for pi with prompt/response editing, annotations, critiques, prompt/response history, and live Markdown/LaTeX/code preview",
5
5
  "type": "module",
6
6
  "license": "MIT",