Skip to content

Add Markdown document templates#1283

Open
colinchambachan wants to merge 1 commit intostablyai:mainfrom
colinchambachan:markdown-support-document-templates
Open

Add Markdown document templates#1283
colinchambachan wants to merge 1 commit intostablyai:mainfrom
colinchambachan:markdown-support-document-templates

Conversation

@colinchambachan
Copy link
Copy Markdown
Contributor

@colinchambachan colinchambachan commented Apr 30, 2026

Summary

  • Adds global Markdown document templates to General settings with Add/Edit/Delete flows.
  • Supports deterministic placeholder expansion for {{title}}, {{filename}}, {{date}}, {{time}}, and {{datetime}}.
  • Adds an editor-scoped Insert Template menu for Markdown edit tabs; templates append to existing content instead of replacing it.
  • Keeps existing Markdown creation flows unchanged; this PR does not add a new Explorer or file-creation surface.

Closes #1222

Screenshots / Recording

Screen.Recording.2026-04-30.at.8.50.42.AM.mov

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build

Note: local build exits 0 but prints the existing /usr/local/bin/orca-dev symlink permission warning.

AI Code Review Summary

I reviewed this change for scope, cross-platform behavior, and security-sensitive paths. The implementation keeps templates in app settings and inserts rendered Markdown through the existing editor draft/save path, so it does not introduce new filesystem write IPC or alternate document-creation behavior.

Cross-platform check: no new keyboard shortcuts were added. Placeholder dates use local Date fields instead of toISOString(), avoiding timezone shifts. Filename/title extraction normalizes path separators for display/template variables only and does not introduce security-sensitive path handling.

Security audit: template content is user-authored Markdown inserted into the user's current document. Unknown placeholders are preserved rather than evaluated. Persisted template data is normalized on load/update so malformed stored values do not leak into renderer state. No new file overwrite path, absolute path construction path, or traversal-sensitive IPC was added.

Platform Notes

Tested locally on macOS with Node v22.22.2. Orca targets macOS, Linux, and Windows; this change avoids platform-specific shortcuts and filesystem assumptions.

Follow-ups Intentionally Out of Scope

  • Repo-local templates
  • File-backed template discovery
  • Template import/export
  • Custom user-defined variables
  • New Markdown creation surfaces

@colinchambachan colinchambachan marked this pull request as ready for review April 30, 2026 12:52
@colinchambachan colinchambachan force-pushed the markdown-support-document-templates branch from 5a0309f to 700cc91 Compare April 30, 2026 12:57
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.

Markdown: support document templates

2 participants