Addresses #35 maintainer feedback: gate paste-time resolution behind a
default-off toggle with 5-min TTL on lastCopyMeta. Switch from DOM
paste (capture phase) to editor-paste workspace event with documented
defaultPrevented yield protocol; register only when active.
Also fixes a pre-existing bug where simplifiedHeadingToNoteLink was
never read — the simplification fired unconditionally when filename
matched heading.
Designed, carefully reviewed, and edited by @lightmotive in collaboration with Claude Code.
Move the inline metadata-construction logic from the three copy paths
(block/heading/file) into pure helpers in src/copyMetadata.ts, matching
the project's pure-function test style. Adds 25 unit tests covering
alias, subpath, and embed computation for each copy type.
Intercept paste (DOM capture phase) to regenerate Easy Copy links via
generateMarkdownLink(), resolving shortest/relative/absolute paths based
on the destination file. Metadata is cleared on manual copy to prevent
false interception of non-Easy-Copy content.
Strip # | ^ : %% [[ ]] from heading link targets to match Obsidian's
autocomplete behavior. Fix compareIgnoreCase to use strict equality
instead of includes(), preventing false-positive note-link simplification.
Obsidian doesn't parse Markdown links with literal spaces in the URL
portion (e.g. `[text](file#My Heading)`). This encodes spaces as `%20`
in the URL part of all Markdown-format links — heading links, block
links, and file links — so they render correctly.
Closes#29
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce a new boolean setting simplifiedHeadingToNoteLink to
allow simplifying heading links into note links when the filename
matches the heading. Update default settings to enable the option.
Add related i18n keys and translations across en/zh/zh-tw:
- note-link-simplified
- simplified-heading-to-note-link
- simplified-heading-to-note-link-desc
Update settings UI to expose the toggle with description and save
behavior, and re-render the settings panel when toggled.
These changes improve UX by letting users copy a simpler note link
instead of a filename#heading link when the filename corresponds to
the heading (commonly for top-level headings).
Add configurable limits for generated block display text and wire them
through UI, defaults, localization, and usage logic.
- Add blockDisplayWordLimit and blockDisplayCharLimit to settings with
defaults (3 words, 5 chars).
- Expose new settings in the Settings tab show the two limit inputs
only when autoBlockDisplayText is enabled and save changes.
- Use the configured limits in main generation logic (fall back to
defaults if unset) to trim English-like text by words and other
languages by characters.
- Add i18n keys and translations for labels and descriptions in all
languages.
This allows users to control how much text is included when the plugin
auto-generates display text for block links.
Update copyHeading to use frontmatter when configured.
useFrontmatterAsDisplay is enabled, read the active file's
frontmatter key (configurable via frontmatterKey, default 'title')
and use that value as the filename portion of the display text.
Preserve existing behavior when frontmatter is absent.
Also adjust heading link generation to avoid redundant display
text: if the computed display text exactly equals
"filename#heading", emit a simple [[filename#heading]] link
instead of including an identical pipe-qualified label.
These changes make generated heading links respect a frontmatter
display name and produce cleaner links when the label would
duplicate the target.
Introduce a new setting `headingLinkSeparator (default '#')
customize the separator used between filename and heading when the
"Use heading as display text" option is disabled.
- Add `headingLinkSeparator` to settings type and defaults.
- Add localization keys and translations (en/zh/zh-TW) for the new
setting and its description.
- Update settings UI to render a text input for the separator and
re-render when "use heading as display text" toggles so the control
shows/hides correctly.
- Use the configured separator when composing display text for heading
links.
- Simplify a Wiki-link conditional to avoid redundant `useHeadingAsDisplayText`
check when filename equals selected heading.
This allows users to customize the filename-heading delimiter for copied
heading links.