Skip to content

Commit c1bb57d

Browse files
committed
Fix errors
1 parent bf5747a commit c1bb57d

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

docs/_docset.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,7 @@ toc:
149149
- folder: baz
150150
children:
151151
- file: qux.md
152-
- title: "Getting Started Guide"
153-
crosslink: docs-content://get-started/introduction.md
152+
- title: "Getting Started Guide"
153+
crosslink: docs-content://get-started/introduction.md
154+
- title: "Test title"
155+
crosslink: docs-content://solutions/search/elasticsearch-basics-quickstart.md

docs/configure/content-set/navigation.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,38 @@ cross_links:
7272
- docs-content
7373
```
7474

75+
#### Adding cross-links in Markdown content
76+
7577
To link to a document in the `docs-content` repository, you would write the link as follows:
7678

77-
```
79+
```markdown
7880
[Link to docs-content doc](docs-content://directory/another-directory/file.md)
7981
```
8082

83+
You can also link to specific anchors within the document:
84+
85+
```markdown
86+
[Link to specific section](docs-content://directory/file.md#section-id)
87+
```
88+
89+
#### Adding cross-links in navigation
90+
91+
Cross-links can also be included in navigation structures. When creating a `toc.yml` file or defining navigation in `docset.yml`, you can add cross-links as follows:
92+
93+
```yaml
94+
toc:
95+
- file: index.md
96+
- title: External Documentation
97+
cross_link: docs-content://directory/file.md
98+
- folder: local-section
99+
children:
100+
- file: index.md
101+
- title: API Reference
102+
cross_link: elasticsearch://api/index.html
103+
```
104+
105+
Cross-links in navigation will be automatically resolved during the build process, maintaining consistent linking between related documentation across repositories.
106+
81107
### `exclude`
82108

83109
Files to exclude from the TOC. Supports glob patterns.

tests/Elastic.Markdown.Tests/TestCrossLinkResolver.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public class TestCrossLinkResolver : ICrossLinkResolver
1919

2020
public Task<FetchedCrossLinks> FetchLinks(Cancel ctx)
2121
{
22+
// Clear existing entries to prevent duplicate key errors when called multiple times
23+
LinkReferences.Clear();
24+
DeclaredRepositories.Clear();
25+
2226
// language=json
2327
var json = """
2428
{
@@ -47,7 +51,7 @@ public Task<FetchedCrossLinks> FetchLinks(Cancel ctx)
4751
var reference = CrossLinkFetcher.Deserialize(json);
4852
LinkReferences.Add("docs-content", reference);
4953
LinkReferences.Add("kibana", reference);
50-
DeclaredRepositories.AddRange(["docs-content", "kibana", "elasticsearch"]);
54+
DeclaredRepositories.AddRange(["docs-content", "kibana"]);
5155

5256
var indexEntries = LinkReferences.ToDictionary(e => e.Key, e => new LinkRegistryEntry
5357
{

tests/authoring/Framework/TestCrossLinkResolver.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ type TestCrossLinkResolver (config: ConfigurationFile) =
2828
member this.UriResolver = uriResolver
2929

3030
member this.FetchLinks(ctx) =
31+
// Clear existing entries to prevent duplicate key errors when called multiple times
32+
this.LinkReferences.Clear()
33+
this.DeclaredRepositories.Clear()
34+
3135
let redirects = RepositoryLinks.SerializeRedirects config.Redirects
3236
// language=json
3337
let json = $$"""{
@@ -66,7 +70,6 @@ type TestCrossLinkResolver (config: ConfigurationFile) =
6670
this.LinkReferences.Add("kibana", reference)
6771
this.DeclaredRepositories.Add("docs-content") |> ignore;
6872
this.DeclaredRepositories.Add("kibana") |> ignore;
69-
this.DeclaredRepositories.Add("elasticsearch") |> ignore
7073

7174
let indexEntries =
7275
this.LinkReferences.ToDictionary(_.Key, fun (e : KeyValuePair<string, RepositoryLinks>) -> LinkRegistryEntry(

0 commit comments

Comments
 (0)