Skip to content

pasting a link surrounds text in markdown link - #363

Merged
HermanMartinus merged 2 commits into
HermanMartinus:masterfrom
Talor-A:ta/push/uqrouwooynlo
Aug 11, 2025
Merged

pasting a link surrounds text in markdown link#363
HermanMartinus merged 2 commits into
HermanMartinus:masterfrom
Talor-A:ta/push/uqrouwooynlo

Conversation

@Talor-A

@Talor-A Talor-A commented Aug 5, 2025

Copy link
Copy Markdown

Hi!

I just started writing my first post with bearblog, and noticed a small behavior issue that bugged me: I'm used to being able to select some text and then paste a URL over it in most markdown editors. I implemented a small function to do so in bearblog.

I used document.execcomand where supported as this preserves the input history buffer, so cmd+z still works. there's a fallback if the API isn't supported by the user's browser.

the isURL function is as dead-simple as possible. it could possibly incorporate the new URL() constructor provided by the browser to more reliably identify links, but simpler felt better here.

@Talor-A
Talor-A marked this pull request as ready for review August 5, 2025 22:43
@Talor-A

Talor-A commented Aug 5, 2025

Copy link
Copy Markdown
Author

btw, I read CONTRIBUTING.md and I know this might not get accepted, but I hope it feels like a worthwhile addition.

@HermanMartinus

Copy link
Copy Markdown
Owner

I just gave this a spin, and it wasn't even on my radar as a feature suggestion but feels natural and I can't find any fault with it. I appreciate the consistency with other paste commands and their respective fallbacks 👌

Will merge. Thanks for the contribution.

@HermanMartinus
HermanMartinus merged commit 02d111d into HermanMartinus:master Aug 11, 2025
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