Skip to content

Conversation

@gerteck
Copy link
Member

@gerteck gerteck commented Dec 11, 2025

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:

Closes #2752

Note that some other specific html that is used can cause this bug too, including nested anchors

image

The issue is due to expected html for the lists used in site nav to be tight markdown lists (Use https://markdowntohtml.com/),versus using loose markdown lists which is generated to different html format (nests the anchors in a <p></p> element.

image

Anything you'd like to highlight/discuss:

Fix for SiteNav

Fix the logic by simply recognizing it as an URL anchor if there is a inside the list point instead of it being a direct child to fix these issues.

Fix for Navbar

The previous implementation is that it takes two passes, first pass checks for an exact match in URL, while the second pass finds the first link tha that fits the criteria (default is sibling-or-child, see navbar spec ), and terminates once it finds the first possible match.

This is the issue as it does not find the best match, but rather first match. This means that a base link would always match and hence return early even when a more specific link is present.

Testing instructions:

Nil

Proposed commit message: (wrap lines at 72 characters)

Fix site-nav anchor parsing and navbar link highlighting


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 69.56522% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.65%. Comparing base (affb8e3) to head (ebd59e7).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
packages/vue-components/src/Navbar.vue 72.72% 6 Missing ⚠️
packages/core/src/html/siteAndPageNavProcessor.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2751      +/-   ##
==========================================
+ Coverage   61.36%   61.65%   +0.29%     
==========================================
  Files         130      130              
  Lines        7170     7167       -3     
  Branches     1593     1503      -90     
==========================================
+ Hits         4400     4419      +19     
+ Misses       2580     2558      -22     
  Partials      190      190              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes navigation anchor parsing issues in both site navigation and navbar components. The bug occurred when markdown lists in site navigation used loose list formatting (which wraps anchors in <p> tags) instead of tight lists, and when navbar highlighting selected the first matching link rather than the most specific one.

Key Changes:

  • Updated site navigation to find anchors anywhere within list items instead of only as direct children
  • Refactored navbar highlighting to select the best (most specific) match instead of the first match
  • Added test coverage for the navbar highlighting logic

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/html/siteAndPageNavProcessor.ts Changed anchor selector from direct children to descendant search to handle loose markdown lists
packages/vue-components/src/Navbar.vue Refactored highlighting logic to find the best match based on path specificity instead of returning on first match
packages/vue-components/src/tests/Navbar.spec.js Added test case verifying that the most specific link is highlighted over broader matches

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gerteck gerteck merged commit cd78196 into MarkBind:master Dec 15, 2025
10 checks passed
@github-actions github-actions bot added the r.Patch Version resolver: increment by 0.0.1 label Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r.Patch Version resolver: increment by 0.0.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Site Nav Component bug for loose markdown lists and Navbar highlighting

1 participant