My linebreaks are not working when i try to use a custom filter and safe in my web site for publishing post.
html:
<p>{{ text|striptags|linebreaks|mention|safe }}</p>
mention is my custom filter and my templatetags is:
@register.filter(name='mention',is_safe=True)
@stringfilter
def mention(value):
res = ""
for i in value.split():
if i[0] == '#':
if len(i[1:]) > 1:
i = f'<a href="/recommendation/?q=%23{i[1:]}&submit=Search">{i}</a>'
res = res + i + ' '
return res
at the end i am using 'safe' so that the user can see the link.it is working but when i type linebreaks i am not seing the linebreaks inside my html.What am i doing wrong ? do i have problem in ordering my filter ?
textthat has issue.