title: How to highlight searched queries in result page of Django template?
body: <p>I have the following search query in <code>views.py</code>:</p>
  
  <pre><code>class SearchView(View):
      def get(self, request, *args, **kwargs):
          queryset = BlogPost.objects.all()
          query = request.GET.get('q')
          if query:
              queryset = queryset.filter(
                  Q(title__icontains=query) |
                  Q(content__icontains=query)
              ).distinct()
          context = {
              'queryset': queryset,
              'query': query,
          }
          return render(request, 'blogs/search_result.html', context)
  </code></pre>
  
  <p>and if I search a word like <code>Tesla</code> the results shown in result template is as below:</p>
  
  <p><a href="https://i.stack.imgur.com/SOOg3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SOOg3.png" alt="enter image description here"></a></p>
  
  <p>Please help me, how do I highlight the searched query in yellow color in Django templates? Thank you for help!</p>
  
  <p>edit:
  This is the template code with search box</p>
  
  <pre><code>&lt;div class="card my-4"&gt;
      &lt;div class="card-body"&gt;
          &lt;div class="card-title"&gt;Search blog&lt;/div&gt;
          &lt;form action="{% url 'blog:search_blog' %}"&gt;
              {% csrf_token %}
              &lt;input type="text" class="form-control" name="q" placeholder="What are you looking for?"&gt;
              &lt;input type="submit" value="Search" class="btn btn-success btn-sm mt-3"&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the template for result_search</p>
  
  <pre><code>{% block content %}
  &lt;div class="container bg-light w-100"&gt;
      &lt;h2 class="display-6 border-bottom py-3"&gt;Results for "{{ query }}"&lt;/h2&gt;
      {% for post in queryset %}
      &lt;div class="my-1"&gt;
          &lt;a class="link" href="{{ post.get_absolute_url }}"&gt;{{ post.title }}&lt;/a&gt;
      &lt;/div&gt;
      {% endfor %}
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>Thank you</p>
  
  <p>Edit 2: Daniel Roseman, Sir this is the html below I highlighted it in yellow.
  <a href="https://i.stack.imgur.com/gkwQp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gkwQp.png" alt="enter image description here"></a></p>