coleifer / micawber

a small library for extracting rich content from urls
http://micawber.readthedocs.org/
MIT License
635 stars 91 forks source link

Option to customize fallback behavior if provider not available #89

Closed danjac closed 5 years ago

danjac commented 5 years ago

At present if no provider is found for a URL, and urlize_all is True, the urlize function appears to always be called which renders a simple link. There doesn't appear to be a way to change this.

I'd like to be able to customize this fallback behavior - perhaps by passing in a function as is done with the handlers - for example if I want to render the link with target="_blank", or use the domain instead of the full URL in the title, etc.

Is there a way to do this at present?

coleifer commented 5 years ago

I've somewhat addressed this by allowing an additional parameter to the relevant methods that consists of arbitrary key-value pairs that get turned into attribute pairs on the resultant tag.

Lots of other changes, too

81e54d9451899041f8c41311d9a7ed8e4dd17615