Skip to content

Conversation

theletterf
Copy link
Contributor

This PR adds crosslinks as accepted item types in docset.yml toc directives.

For example:

toc:
  - file: index.md
  - title: External Documentation
    crosslink: docs-content://directory/file.md

Copy link

github-actions bot commented Jul 25, 2025

🔍 Preview links for changed docs

@theletterf
Copy link
Contributor Author

@Mpdreamz @bmorelli25 Wanted to give this one a try. Seems to work (check the Testing section, last two items).

If the code is ugly, please feel free to salvage whatever looks useful in this PR, or commit directly.

@theletterf
Copy link
Contributor Author

@Mpdreamz Anything missing for this one? Minus the remaining comment.

@theletterf theletterf disabled auto-merge August 22, 2025 09:27
@theletterf
Copy link
Contributor Author

theletterf commented Aug 22, 2025

@Mpdreamz I've added a utility class to validate crosslinks, used for both the Markdown or in the nav.

With...

      - file: cross-links.md
        children:
          - title: "Getting Started Guide"
            crosslink: docs-content://get-started/introduction.md
          - title: "Title"
          - crosslink: https://www.google.com
          - title: "Item"
            crosslink: docs-content://get-started/item.md

The following warnings appear:

error::e.d.t.d.Log           :: Table of contents entries with only a 'title' are not allowed. Entry must specify content (file, crosslink, folder, or toc). Title: 'Title' (/Users/fabri/repos/docs-builder/docs/_docset.yml:135)

error::e.d.t.d.Log           :: Cross-link entries must have a 'title' specified. Cross-link: docs-content://get-started/item.md (/Users/fabri/repos/docs-builder/docs/_docset.yml:136)

Error: Cross-link URI 'https://www.google.com' cannot use standard web/protocol schemes (ftp, mailto, https, file, jdbc, tel, http). Use cross-repository schemes like 'docs-content://', 'kibana://', etc.
     ┌─[/Users/fabri/repos/docs-builder/docs/_docset.yml]
     │
 136 │           - crosslink: https://www.google.com
     ·             ─                                
     ·                                               
     │
     └─

@theletterf theletterf requested a review from Mpdreamz August 22, 2025 10:12
@Mpdreamz
Copy link
Member

This PR is finally failing like I was expecting it too :)

https://github.com/elastic/docs-builder/actions/runs/17245378751/job/48933555065?pr=1615#step:5:154

The sitemap builder does not yet know about the new CrosslinkReference type, will amend the PR.

…slinks (#1784)

* Remove `Fetch` from CrossLinkResolver, enforce eager fetching of crosslinks.

This removes a hidden requirement on `DocumentationSet` that its resolver is not usable until `DocumentationGenerator.GenerateAll()` has been called.

We now enforce `DocumentationSet` receives a `ICrossLinkResolver` that is ready to resolve crosslinks.

* Found more cases of unhandled navigation types

* Remove new caching behavior in DocSetConfigurationCrossLinkFetcher
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

LGTM but want @cotti to review as well since I did a bunch of changes here as well.

Copy link
Contributor

@cotti cotti left a comment

Choose a reason for hiding this comment

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

👍

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

Successfully merging this pull request may close these issues.

3 participants