{% extends "base.html" %}

{% block content %}
{% include "markdown-parser.html" %}
<h2>{{ tag_name }} ({{ search_result | length }})</h2>
<ul>
  {% for res in search_result %}
    <li><a href="/dataobj/{{ res['id'] }}">{{ res['title'] }}</li></a>
    {% if "matches" in res %}
      {% for match in res["matches"] %}
        <div class="markdown-result">{{ match }}</div>
      {% endfor %}
    {% endif %}
  {% endfor %}
</ul>
<script>
  document.querySelectorAll(".markdown-result").forEach((match) => {
    match.innerHTML = window.parser.customRender(`> ${match.innerHTML.trim()}`)
  })
</script>


{% endblock %}
