Skip to content

feat(storage): support filename variables in asset folders - #743

Merged
murongg merged 1 commit into
v2from
feature/742-image-folder-template
Sep 22, 2026
Merged

murongg merged 1 commit into
v2from
feature/742-image-folder-template

Conversation

@murongg

@murongg murongg commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

The local image folder now supports ${filename}, using the current document name without its extension. For example, ${filename}.assets saves images inserted into note.md under note.assets/; assets/${filename} and repeated placeholders also work. Existing static folder settings keep their behavior.

  • Resolve templates for desktop and web image/attachment saves. Desktop file imports and Markdown bundles reuse the attachment writer, so exports resolve against the exported document name.
  • Keep attachments visible in matching directories after document renames. Cleanup resolves exact folders against scanned Markdown documents rather than using the visibility matcher to authorize deletion.
  • Reject unsafe expanded paths and retain existing filesystem checks. Preserve existing folders and links when a document is renamed; new saves use its new name.
  • Explain the variable and rename behavior in all settings locales. Decode local Markdown image links correctly in the web runtime, including Unicode, spaces, literal percent sequences, and encoded # characters.

Closes #742.

Validation

297 relevant automated tests passed:

  • corepack pnpm --filter @markra/markdown test — 59 tests
  • corepack pnpm --filter @markra/app test src/lib/workspace-assets.test.ts src/hooks/useMarkdownFileTree.test.tsx src/hooks/useWorkspaceAssetCleanup.test.tsx src/lib/image-upload.test.ts src/lib/settings/editor-preferences.test.ts src/components/settings/StorageSettings.test.tsx — 98 tests; affected tree/index tests rerun after final changes
  • corepack pnpm --filter @markra/web test — 50 tests
  • cargo test --lib markdown_files:: (in apps/desktop/src-tauri) — 90 tests, including real temporary-filesystem saves and cleanup
  • corepack pnpm --filter @markra/markdown --filter @markra/app --filter @markra/web typecheck:test — passed
  • corepack pnpm build — passed; web build and test typecheck rerun after the final URL-decoding change
  • cargo fmt --check and git diff --check — passed

New behavior tests were run failing before implementation. Interactive desktop QA was not run.

Resolve document-based asset folders for local images, attachments, and cleanup while preserving existing links after document renames.

Closes #742
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
markra-web Ready Ready Preview Sep 21, 2026 3:18am UTC

@murongg
murongg merged commit c319526 into v2 Sep 22, 2026
23 checks passed
@murongg
murongg deleted the feature/742-image-folder-template branch September 22, 2026 22:25

This branch was successfully deployed

1 active deployment
Preview — 6064f60a Deployed Sep 21, 2026 by vercel[bot]
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.

[Feature]: 图片存储自定义路径支持获取文件名

1 participant