Skip to main content

find_tag_end

Function find_tag_end 

Source
pub const fn find_tag_end(html: &str, tag_start: usize) -> usize
Expand description

Returns the absolute end index (one past the closing >) of the HTML tag that starts at tag_start. Skips > characters inside quoted attribute values (single and double quotes).

§Examples

use ssg::audit::gates::find_tag_end;
let html = "<br>x";
assert_eq!(find_tag_end(html, 0), 4);

Scan to the end of an HTML tag.

Skips > inside quoted attribute values.

Re-exported from ssg-a11y, which owns the single implementation. This crate previously carried three copies of it and ssg-a11y a fourth; they were byte-identical apart from visibility, and when clippy 1.98 added missing_const_for_fn the lint fired on each one separately — four sequential CI round-trips for one function (ssg#711).

The dependency already ran this way (ssg -> ssg-a11y), so sharing costs no new edge and leaves that crate standalone, as its description promises. Returns the index one past the closing > of the tag at tag_start.

Skips > characters inside double- or single-quoted attribute values, so an inline SVG data: URL in a src attribute cannot truncate the tag prematurely.