Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/syntax/applies.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ applies:
Are equivalent, note `all` just means we won't be rendering the version portion in the html.


## This section has its own applies annotations
## This section has its own applies annotations [#sections]

:::{applies}
:stack: unavailable
Expand Down
26 changes: 26 additions & 0 deletions docs/source/syntax/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@ Cross links are links that point to a different docset.

The syntax is `<scheme>://<path>`, where <scheme> is the repository name and <path> is the path to the file.

## Auto Text Links

If you link to a local markdown file but omit any link text `docs-builder` will use the target's [title](titles.md).

```markdown
[](applies.md)
```
will output: [](applies.md)

You can go one step further to auto generate link text for headings within files:

```markdown
[](applies.md#sections)
```

will output: [](applies.md#sections)

This also applies to local anchors


```markdown
[](#anchor-link)
```

will output: [](#anchor-link)

## Heading anchors

Headings will automatically create anchor links in the resulting html.
Expand Down
5 changes: 4 additions & 1 deletion docs/source/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
title: Testing
---

The files in this directory are used for testing purposes. Do not edit these files unless you are working on tests.
The files in this directory are used for testing purposes. Do not edit these files unless you are working on tests.


###### [#synthetics-config-file]
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,20 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice)

if (link.FirstChild == null || !string.IsNullOrEmpty(anchor))
{
var file = string.IsNullOrWhiteSpace(url) ? context.Path
: context.Build.ReadFileSystem.FileInfo.New(Path.Combine(context.Build.SourcePath.FullName, url.TrimStart('/')));
var file = string.IsNullOrWhiteSpace(url)
? context.Path
: url.StartsWith('/')
? context.Build.ReadFileSystem.FileInfo.New(Path.Combine(context.Build.SourcePath.FullName, url.TrimStart('/')))
: context.Build.ReadFileSystem.FileInfo.New(Path.Combine(context.Path.Directory!.FullName, url));
var markdown = context.GetDocumentationFile?.Invoke(file) as MarkdownFile;
if (markdown == null)
{
processor.EmitWarning(line,
column,
length,
$"'{url}' could not be resolved to a markdown file while creating an auto text link, '{file.FullName}' does not exist.");
}

var title = markdown?.Title;

if (!string.IsNullOrEmpty(anchor))
Expand Down
Loading