Skip to content

Add LLMs nav link and anchor-js#97

Merged
koriym merged 1 commit intomasterfrom
add-llms-anchor-js
Jan 22, 2026
Merged

Add LLMs nav link and anchor-js#97
koriym merged 1 commit intomasterfrom
add-llms-anchor-js

Conversation

@koriym
Copy link
Member

@koriym koriym commented Jan 22, 2026

Summary

  • Add LLMs link to navigation header for AI-friendly documentation access
  • Add anchor-js to show hover links on h2-h4 headings (consistent with bearsunday.github.io)

Summary by Sourcery

Add an LLMs navigation link to the manuals header and enable anchored heading links in manual pages.

New Features:

  • Expose an LLMs text resource via a new navigation link in the manuals header.
  • Add automatic anchor links to h2–h4 headings on manual pages using anchor-js.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added "LLMs" navigation link to header menu
    • Enabled automatic anchor links on manual pages for improved navigation within content sections

✏️ Tip: You can customize this high-level summary in your review settings.

- Add LLMs link to navigation header for AI-friendly documentation access
- Add anchor-js to show hover links on h2-h4 headings
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds an LLMs link to the manuals navigation header and conditionally loads AnchorJS on manual pages to add hoverable anchor links to H2–H4 headings.

Sequence diagram for manual page load with conditional AnchorJS

sequenceDiagram
  actor User
  participant Browser
  participant Server
  participant AnchorJSCDN

  User->>Browser: Request_manual_page
  Browser->>Server: GET_manual_page
  Server-->>Browser: HTML_with_manual_header_and_footer
  Browser->>Browser: Parse_HTML
  alt Page_category_is_Manual
    Browser->>AnchorJSCDN: GET_anchor_min_js
    AnchorJSCDN-->>Browser: anchor_min_js
    Browser->>Browser: Execute_anchors_add_h2_h3_h4
  else Page_category_is_not_Manual
    Browser->>Browser: Skip_loading_AnchorJS
  end
Loading

File-Level Changes

Change Details Files
Add LLMs navigation link in the manuals header.
  • Extend the manuals navbar with a new list item for LLMs.
  • Link the new LLMs item to /llms-full.txt without any active-state handling.
_includes/manuals/1.0/header.html
Conditionally load AnchorJS on manual pages to add anchor links to headings.
  • Wrap new script tags in a Jekyll conditional checking page.category == 'Manual'.
  • Load AnchorJS from jsDelivr CDN.
  • Initialize AnchorJS to attach anchors to h2, h3, and h4 elements before the existing table-of-contents script.
_includes/manuals/1.0/footer.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

Two Jekyll template includes receive additions: the footer conditionally loads anchor-js for Manual category pages to generate headings anchors, and the header adds a new "LLMs" navigation link. Both are non-breaking, isolated enhancements.

Changes

Cohort / File(s) Summary
Header & Footer Template Enhancements
_includes/manuals/1.0/footer.html, _includes/manuals/1.0/header.html
Footer: Adds conditional block to load anchor-js library and initialize anchors for h2, h3, h4 elements when page.category == 'Manual'. Header: Introduces new "LLMs" navigation item linking to /llms-full.txt.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With whiskers twitched and paws a-tap,
I add some anchors to close the gap,
And links to LLMs, shiny and new,
These templates now help readers right through! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding an LLMs navigation link and integrating anchor-js for heading anchors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • Consider scoping anchor-js to the article container (e.g. anchors.add('#article h2, #article h3, #article h4');) so it doesn’t unexpectedly add anchors to headings elsewhere on the page.
  • If llms-full.txt is intended to behave like other main navigation destinations, think about whether it should get active state handling and/or any specific styling class so it’s visually consistent with the rest of the nav.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider scoping `anchor-js` to the article container (e.g. `anchors.add('#article h2, #article h3, #article h4');`) so it doesn’t unexpectedly add anchors to headings elsewhere on the page.
- If `llms-full.txt` is intended to behave like other main navigation destinations, think about whether it should get active state handling and/or any specific styling class so it’s visually consistent with the rest of the nav.

## Individual Comments

### Comment 1
<location> `_includes/manuals/1.0/footer.html:18-19` </location>
<code_context>
 <script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
 <script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
+{% if page.category == 'Manual' %}
+<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
+<script>anchors.add('h2, h3, h4');</script>
+{% endif %}
 <script src="/js/generate-table-of-contents/index.min.js"></script>
</code_context>

<issue_to_address>
**🚨 suggestion (security):** Consider adding SRI attributes to the new CDN-loaded script for consistency and security.

The existing third-party scripts here all specify `integrity` and `crossorigin`, but the new `anchor-js` script does not. Please add the appropriate SRI hash and `crossorigin` value (if supported by the CDN) to keep our security controls consistent.

Suggested implementation:

```
{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/anchor.min.js"
        integrity="<!-- TODO: insert SRI hash for [email protected]/anchor.min.js -->"
        crossorigin="anonymous"></script>
<script>anchors.add('h2, h3, h4');</script>
{% endif %}

```

1. Compute the correct SRI hash for `https://cdn.jsdelivr.net/npm/[email protected]/anchor.min.js` (e.g., using `openssl dgst -sha384 -binary | openssl base64 -A`) and replace the `<!-- TODO: ... -->` placeholder with the real `sha384-...` value.
2. If you prefer to track a different specific version of `anchor-js`, adjust the `@4.3.1` segment and compute the SRI hash for that exact URL instead.
</issue_to_address>

### Comment 2
<location> `_includes/manuals/1.0/footer.html:17-20` </location>
<code_context>
 <script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
+{% if page.category == 'Manual' %}
+<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
+<script>anchors.add('h2, h3, h4');</script>
+{% endif %}
 <script src="/js/generate-table-of-contents/index.min.js"></script>
</code_context>

<issue_to_address>
**suggestion:** Limit anchor-js scope to the article container to avoid affecting non-content headings.

`anchors.add('h2, h3, h4');` applies to all headings on the page, which can include nav/sidebar/footer content. Since the table of contents is already scoped to `#article`, consider matching that scope (e.g. `anchors.add('#article h2, #article h3, #article h4');`) so anchors are only added to main content headings.

```suggestion
{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>anchors.add('#article h2, #article h3, #article h4');</script>
{% endif %}
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +19
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>anchors.add('h2, h3, h4');</script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider adding SRI attributes to the new CDN-loaded script for consistency and security.

The existing third-party scripts here all specify integrity and crossorigin, but the new anchor-js script does not. Please add the appropriate SRI hash and crossorigin value (if supported by the CDN) to keep our security controls consistent.

Suggested implementation:

{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/anchor.min.js"
        integrity="<!-- TODO: insert SRI hash for [email protected]/anchor.min.js -->"
        crossorigin="anonymous"></script>
<script>anchors.add('h2, h3, h4');</script>
{% endif %}

  1. Compute the correct SRI hash for https://cdn.jsdelivr.net/npm/[email protected]/anchor.min.js (e.g., using openssl dgst -sha384 -binary | openssl base64 -A) and replace the <!-- TODO: ... --> placeholder with the real sha384-... value.
  2. If you prefer to track a different specific version of anchor-js, adjust the @4.3.1 segment and compute the SRI hash for that exact URL instead.

Comment on lines +17 to +20
{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>anchors.add('h2, h3, h4');</script>
{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Limit anchor-js scope to the article container to avoid affecting non-content headings.

anchors.add('h2, h3, h4'); applies to all headings on the page, which can include nav/sidebar/footer content. Since the table of contents is already scoped to #article, consider matching that scope (e.g. anchors.add('#article h2, #article h3, #article h4');) so anchors are only added to main content headings.

Suggested change
{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>anchors.add('h2, h3, h4');</script>
{% endif %}
{% if page.category == 'Manual' %}
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>anchors.add('#article h2, #article h3, #article h4');</script>
{% endif %}

@koriym
Copy link
Member Author

koriym commented Jan 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@koriym koriym merged commit c2ce263 into master Jan 22, 2026
2 checks passed
@koriym koriym deleted the add-llms-anchor-js branch January 22, 2026 18:22
@koriym
Copy link
Member Author

koriym commented Jan 23, 2026

@sourcery-ai Added SRI attributes and scoped anchor-js to #article container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant