Commit Graph
5 Commits
Author SHA1 Message Date
upstream ed42ec389b Upstream Pagefind/pagefind state of the touched files before a8baf2727f 2026-10-03 01:33:54 +02:00
dualfroz 085385c3e4 feat: apply Pagefind attributes by selector through config rules
exclude_selectors is the only way the config can reach into a page, and it
carries the semantics of data-pagefind-ignore="index". Every other control
Pagefind has lives on an attribute, so reaching it from the config meant a
new flag per attribute.

Add a rules list that pairs a selector with the attributes to set on the
elements it matches. The attributes are applied before every other handler,
so the rest of the parser reads them exactly as if the page had carried
them, and every documented attribute is reachable without new flags.

An attribute already present on the element wins, so a rule never overrides
markup. A selector that cannot be parsed is reported and skipped.

Rules are config-file only: a list of selectors with attribute maps does not
fit a CLI flag or an environment variable.
2026-09-23 10:26:08 +02:00
upstream c036b250ba Upstream Pagefind/pagefind state of the touched files before e920ec18c5 2026-09-23 10:26:08 +02:00
dualfroz a36c86c90c fix: exclude-selectors matches are excluded entirely, not just ignored
--exclude-selectors marked a match as "ignored", the same as a bare
data-pagefind-ignore, so metadata and filters inside the match were still
collected. Excluding img.emoji, for example, still let the emoji become the
page's auto-detected image.

The status was also applied after the element had been processed. For a void
element such as <img> that is too late twice over: its metadata has already
been read, and the parser has already popped back to the parent, so the
status landed on the parent instead and wiped out the rest of the page.

Match the selectors in a handler registered ahead of the main element
handler, which now reads that flag and gives the node Excluded status up
front. The built-in REMOVE_SELECTORS (head, nav, footer, ...) keep the old
Ignored status, so metadata tagged inside them still counts.

Fixes #692
2026-09-13 15:31:49 +02:00
upstream 5205bba40d Upstream Pagefind/pagefind state of the touched files before bd9ded0754 2026-09-11 23:13:08 +02:00