-
Notifications
You must be signed in to change notification settings - Fork 30
Fix empty crosslink text to auto-populate page titles #1954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: reakaleek <[email protected]>
Co-authored-by: reakaleek <[email protected]>
@copilot confirm my assumption. So this will start adding the title to the link metadata. As long as it's null or empty. it will behave as before. But as soon as the link index started adding the title, the title will be rendered. |
Correct. The implementation is fully backwards compatible:
The |
Fixes an issue where empty link text in crosslinks didn't render the target page title, unlike internal links which automatically populate titles when link text is omitted.
Problem
When using crosslink syntax with empty text like
[](docs-content:///solutions/search/semantic-search.md)
, the link would render with no text, even when the target page has a title. This was inconsistent with internal links where[](local-file.md)
automatically uses the target page's title.The root cause was that crosslink processing bypassed the
ProcessLinkText
method that handles auto-title population for internal links.Solution
Enhanced the crosslink processing pipeline to:
title
property toLinkMetadata
with backwards-compatible JSON serializationTryGetLinkMetadata
method toICrossLinkResolver
for accessing crosslink metadataProcessCrossLink
to check for empty link text and populate with title from metadata when availableBehavior
[](crosslink://file.md)
now auto-populates with the page title when available in crosslink metadataTesting
Added comprehensive tests covering:
All 627 existing tests continue to pass, ensuring no regressions.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.