MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / deriveTitle

Function deriveTitle

apps/desktop/src/cli/commands/capture.ts:45–51  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

43 * chars. So a captured task `- [ ] buy milk` titles the note "buy milk"
44 * (the marker still lives in the body). */
45export function deriveTitle(body: string): string {
46 for (const line of body.split('\n')) {
47 const t = stripLeadingMarker(line.trim())
48 if (t) return t.slice(0, 60)
49 }
50 return new Date().toISOString().slice(0, 19).replace(/[:T]/g, '-')
51}
52
53/** Strip a leading heading (`#`), list bullet (`-`/`*`/`+`, `1.`) and/or task
54 * checkbox (`[ ]`/`[x]`) so titles derived from list/task lines read cleanly. */

Callers 2

capture.test.tsFile · 0.90
cmdCaptureFunction · 0.85

Calls 1

stripLeadingMarkerFunction · 0.85

Tested by

no test coverage detected