File tree Expand file tree Collapse file tree
Source Code/layouts/partials/scholarly Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- {{- /* formats .Content headings by adding an anchor */ -}}
2- {{ . | replaceRE "(< h [1-6] id =\ "([^\"]+)\".+)(</ h[1-6]+> )" "${1}< a hidden class =\ "anchor\" aria-hidden=\"true\" href=\"#${2}\"> #</ a > ${3}" | safeHTML }}
3-
1+ <!-- ==============================================================================
2+ - File: Anchored_Headings.html (Deep-Linking Infrastructure)
3+ - Author: Amey Thakur
4+ - Profile: https://github.com/Amey-Thakur
5+ - Repository: https://github.com/Amey-Thakur/Amey-Thakur.github.io
6+ - Release Date: December 16, 2025
7+ - License: MIT License
8+ - ==============================================================================
9+ -
10+ - DESCRIPTION:
11+ - This partial post-processes the document content to inject deep-linking
12+ - anchor points within HTML headings. It facilitates precise scholarly
13+ - citation and fragment-based navigation.
14+ -
15+ - HOW IT WORKS:
16+ - It utilizes a regular expression replacement strategy to identify headings
17+ - (H1-H6) that already possess unique IDs. It then appends a hidden anchor
18+ - link (#) within the heading tags, pointing back to the fragment identifier.
19+ -
20+ - TECH STACK:
21+ - - Hugo Template Regex (replaceRE)
22+ - - HTML5 Fragment Identifiers
23+ - - CSS-driven Anchor Styling
24+ -
25+ - ============================================================================== -->
26+
27+ {{- /* Orchestration Strategy: Injecting fragment markers for enhanced scholarly citation. */ -}}
28+ {{ . | replaceRE "(< h [1-6] id =\ "([^\"]+)\".+)(</ h[1-6]+> )" "${1}< a hidden class =\ "anchor\" aria-hidden=\"true\"
29+ href=\"#${2}\"> #</ a > ${3}" | safeHTML }}
You can’t perform that action at this time.
0 commit comments