untitaker/hyperlink

Ignore links inside `<script>` tags

WhyNotHugo opened this issue · 4 comments

The script in here should be ignored; it's not actual HTML.

<script id="algolia__template" type="text/template">
{% raw %}
  <div class="algolia__result">
    <a class="algolia__result-link" href="{{ full_url }}#algolia:{{ css_selector }}">{{{ _highlightResult.title.value }}}</a>
    {{#posted_at}}
    <div class="algolia__result-date">{{ posted_at_readable }}</div>
    {{/posted_at}}
    <div class="algolia__result-text">{{{ _highlightResult.text.value }}}</div>
  </div>
{% endraw %}
</script>

Yeah unfortunately this is a known issue. It's a lack of features in the underlying html parsing library, specifically absence of a proper tree builder

underlying html5gum issue: untitaker/html5gum#11

Should be fixed in 0.1.22. There is still no proper tree builder in html5gum, but the library now includes workarounds that work in the majority of cases. Certainly good enough for hyperlink.