Skip to content

fix: prevent title duplication in createNote#6

Merged
sweetrb merged 3 commits intomainfrom
fix/create-note-title-dedup
Mar 27, 2026
Merged

fix: prevent title duplication in createNote#6
sweetrb merged 3 commits intomainfrom
fix/create-note-title-dedup

Conversation

@sweetrb
Copy link
Copy Markdown
Owner

@sweetrb sweetrb commented Mar 27, 2026

Summary

  • Title dedup fix: createNote() no longer sets the name property — instead prepends <h1>title</h1> to the body HTML, letting Notes.app derive the display title from the first body element
  • Plaintext encoding: Backslashes (&#92;) and tabs (<br>) now handled correctly in plaintext content, matching the existing escapeForAppleScript() behavior
  • HTML format: Title is auto-prepended as <h1> for both plaintext and HTML formats
  • Docs: README, CHANGELOG, CLAUDE.md, TECHNICAL_NOTES.md all updated

Inspired by @fredchu's PR #5 — incorporated their core fix with additional backslash/tab handling and comprehensive doc updates.

Test plan

  • npm run lint — clean
  • npm run typecheck — clean
  • npm test — 278 tests pass (272 existing + 6 new)
  • Live tested against real Notes.app: title appears once (not duplicated), special chars render correctly, backslashes preserved, HTML format works, newlines/tabs convert properly
  • All test notes cleaned up after live testing

- Remove 'name' property from AppleScript make new note command
- Prepend title as <h1> in body HTML so Notes.app renders it as display title
- HTML-encode title for safe embedding (&, <, >)
- Handle backslashes (&#92;) and tabs (<br>) in plaintext content encoding
- Add 6 new tests: h1 title, special chars, plaintext encoding, HTML format, backslash, tab
- Update docs: README, CHANGELOG, CLAUDE.md, TECHNICAL_NOTES.md

Inspired by fredchu's PR #5 with additional backslash/tab handling and doc updates.
@sweetrb sweetrb merged commit a393344 into main Mar 27, 2026
2 checks passed
@sweetrb sweetrb deleted the fix/create-note-title-dedup branch March 27, 2026 21:18
@fredchu
Copy link
Copy Markdown
Contributor

fredchu commented Mar 28, 2026

Thanks for the quick turnaround on this! Really impressed by how fast you incorporated the fix and added the extra edge case handling (backslash/tab encoding) plus the doc updates.

My contribution was just a small piece — the project itself is excellent. I use apple-notes-mcp daily as part of my AI assistant workflow and it's been rock solid. Appreciate you building and maintaining this! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants