Skip to content

Improve Obsidian source link handling - #1321

Open
PushOrigin wants to merge 1 commit into
pilotmoon:masterfrom
PushOrigin:feature/obsidian-improve-source-link-handling
Open

Improve Obsidian source link handling#1321
PushOrigin wants to merge 1 commit into
pilotmoon:masterfrom
PushOrigin:feature/obsidian-improve-source-link-handling

Conversation

@PushOrigin

Copy link
Copy Markdown

Summary

Improved source link handling in the Obsidian extension to handle when the captured content is a URL

Changes

  • Skip captured content when URL is present: If captured content is a URL, ignore it and paste only the source link
  • Consistent leading newlines: Added leading newline to captured content unless it's being written to a new file
  • Normalized comparison: Normalize captured content and URLs before comparing to ensure accurate detection of URL in captured content
  • Tests: Added unit tests. Added instructions on how to run existing tests and the unit tests

Testing

New unit tests can be run with npx tsx UnitTests.ts

Related Files

  • source/Obsidian.popclipext/Config.ts - Main logic updates
  • source/Obsidian.popclipext/UnitTests.ts - New test suite

Ignore the captured content if it is just the URL. Paste the source
link only.

Make the leading newline consistent. Add a leading newline to captured
content unless it is being written to a new file.

Normalize the captured content and URL before comparing.

Add unit tests and instructions on how to run tests.
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.

1 participant