MCPcopy
hub / github.com/marimo-team/marimo / buildSubslideNotes

Function buildSubslideNotes

frontend/src/components/slides/slide-notes.ts:32–64  ·  view source on GitHub ↗
(
  subslide: ComposedSubslide<C>,
  slideConfigs: ReadonlyMap<CellId, SlideConfig>,
)

Source from the content-addressed store, hash-verified

30 * fragment's notes, separated by a horizontal-rule line.
31 */
32export const buildSubslideNotes = <C extends { id: CellId }>(
33 subslide: ComposedSubslide<C>,
34 slideConfigs: ReadonlyMap<CellId, SlideConfig>,
35): SubslideNotes => {
36 const blockNotes = subslide.blocks.map((block) =>
37 collectBlockNotes(block.cells, slideConfigs),
38 );
39
40 const slideLevel = subslide.blocks
41 .map((block, i) => (block.isFragment ? "" : blockNotes[i]))
42 .filter((note) => note.length > 0)
43 .join("\n\n");
44
45 const cumulativeByBlock = new Map<number, string>();
46 const revealsSoFar: string[] = [];
47 subslide.blocks.forEach((block, i) => {
48 if (!block.isFragment) {
49 return;
50 }
51 const myNotes = blockNotes[i];
52 if (myNotes.length > 0) {
53 revealsSoFar.push(myNotes);
54 }
55 const accumulated = [slideLevel, ...revealsSoFar]
56 .filter((s) => s.length > 0)
57 .join(BLOCK_JOIN);
58 if (accumulated.length > 0) {
59 cumulativeByBlock.set(i, accumulated);
60 }
61 });
62
63 return { slideLevel, cumulativeByBlock };
64};

Callers 2

SubslideViewFunction · 0.90

Calls 7

collectBlockNotesFunction · 0.85
forEachMethod · 0.80
pushMethod · 0.80
filterMethod · 0.65
setMethod · 0.65
mapMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…