When authors want to link directly to a specific instance of a repeated element in a page — the third paragraph in a long article, the second occurrence of a term, or the fifth heading in a series — standard anchors keyed to IDs are inconvenient if those IDs don’t already exist. nthlink solves this by targeting the nth occurrence of an element type, selector, or pattern and generating a stable link (a permalink) to that occurrence. Why nthlink matters - Granular sharing: Readers can reference one specific occurrence among many similar elements without editing source HTML. - Permalinks for dynamic content: Generated content that repeats templates can be linked to reliably even when markup doesn’t include unique IDs. - Better UX for long documents: Users jump to the exact place they care about (e.g., nth example, nth figure) instead of a nearby anchor. Concept overview nthlink works in three steps: 1. Identify a selector or pattern (e.g., "p", ".note", "h2", or a text match). 2. Count occurrences in document order until reaching the specified index n. 3. Create or scroll to an anchor for that element, and optionally update the URL hash for sharing. Example usage (conceptual) - Link to the 4th paragraph: /article#nthlink=p:4 - Link to the 2nd heading with class "section": /doc#nthlink=h2.section:2 A minimal implementation idea (plain JavaScript) You can implement nthlink in a few lines: querySelectorAll with a selector, pick the (n-1)th element, set element.id if missing (e.g., "nthlink-