@jingo.register.filter
def no_links(string):
 if (not string):
  return string
 if hasattr(string, '__html__'):
  string = string.__html__()
 allowed_tags = bleach.ALLOWED_TAGS[:]
 allowed_tags.remove('a')
 no_links = bleach.clean(string, tags=allowed_tags, strip=True)
 return jinja2.Markup(clean_nl(no_links).strip())

@ jingo . register . filter def no_links ( string ) : if ( not string ) : return string if hasattr ( string , '__html__' ) : string = string . __html__ ( ) allowed_tags = bleach . ALLOWED_TAGS [ : ] allowed_tags . remove ( 'a' ) no_links = bleach . clean ( string , tags = allowed_tags , strip = True ) return jinja2 . Markup ( clean_nl ( no_links ) . strip ( ) )
leave text links untouched .