Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow strings (not just urls) as input, and remove tracking params on all given links. #3

Closed
dessalines opened this issue Jul 27, 2024 · 5 comments
Assignees

Comments

@dessalines
Copy link

It'd be hugely helpful to either add, or alter the existing function to be fn clear_urls(input: &str), and step through any number of urls, while ignoring other text.

IE say there's a comment with multiple links, and some other text:

test(
  "This is a [markdown link](http://example.com/?&&&&), and another: http://example.com/?&&&&",
  "This is a [markdown link](http://example.com/), and another http://example.com/",
);
@jendrikw
Copy link
Owner

This would require a full markdown parser, which is not a problem by itself, but I'm guessing lemmy has to parse it anyways, so doing it twice seems wasteful.

@dessalines
Copy link
Author

dessalines commented Jul 31, 2024

A markdown parser isn't necessary, you only need to identify and parse links in the given text, and replace them at their positions. Plus you wouldn't even know the format being given to this function anyway.

@jendrikw
Copy link
Owner

Implemented and published in 0.0.2 https://crates.io/crates/clearurls/0.0.2

@jendrikw
Copy link
Owner

Let me know if you need anything else

@dessalines
Copy link
Author

Sweet, thx!

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

No branches or pull requests

2 participants