Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:30:08+00:00 2026-05-26T22:30:08+00:00

Hi how should I escape to make the link render? The way I write

  • 0

Hi how should I escape to make the link render?

enter image description here

The way I write it now is with filter:
{{article.text|striptags|urlize|nl2br|safe}}

Can you recommend how to do it?

Related question: https://stackoverflow.com/questions/8179801/autolinebreaks-filter-in-jinja2

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:30:09+00:00Added an answer on May 26, 2026 at 10:30 pm

    Usually I’d like to use HTMLParser for processing (overkill maybe?), sample code below for Python 2.7 (3.0 library is renamed html.parser)

    from HTMLParser import HTMLParser
    
    class MyHTMLParser(HTMLParser):
        def handle_starttag(self, tag, attrs):
            print "Found Start Tag", attrs
    
    s = "noivos, convites de casamento <a href=\"http://www.olharcaricato.com.br\">
            http://www.olharcaricato.com.br</a> more entries here"
    
    parser = MyHTMLParser()
    parser.feed(s)
    

    Outputs: Found Start Tag [('href', 'http://www.olharcaricato.com.br')]

    Note: Implement the code above as a filter, tweak the output to your needs. Example of filter is found at Custom jinja2 filter for iterator

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am tired of always trying to guess, if I should escape special characters
I was writing the helper for my rails app, which should make some manupulations
I'm creating a form where the user should be able to enter any text
I don't think that was the most clear question, but an example should make
I was wondering if there is any way to escape a CDATA end token
I want to make my site hack-proof so this is why I do: Text:
I run all my integers through a (int)Integer to make them safe to use
im trying to write a script , that can rewrites urls in slug way
This question is somewhat related to What’s the simplest way to make a HTTP
Should I start with Django or JavaScript?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.