Closed rbu closed 6 years ago
I'm not sure how many bells and whistles I want to tack on to the default url tag implementation, considering you can do whatever you like by creating your own. To see how the default one works:
https://github.com/dcwatson/bbcode/blob/master/bbcode.py#L156
That said, this isn't the first request for custom behavior, so maybe it's worth making something like a template string that the default url tag can use. Something along the lines of Parser.url_template = '<a href="%s">%s</a>'
that the default implementation could use.
That would also work for us. If you go this route, consider using a format() string like this:
'<a href="{href}">{text}</a>'.format(href='https://example.com', text='site')
That allows reordering the arguments and improves self-documentation of the parameter for users (like me!).
@dcwatson, any update on this? I could provide a PR if you haven't started on this yet and you'd consider merging it
A PR would be much appreciated.
Implemented by #28
It would be nice if we could replace
with this:
<a href="http://example.com/" target="_blank" rel="nofollow">link</a>
by setting an config option to the BBCode instance.