dotnet / dotnet/docfx

[Feature Request] dotnet API link to a specific version?

Open
#10,040 2 comments 0 reactions 0 assignees View on GitHub
dotnet
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**Is your feature request related to a problem? Please describe.**

I build markdown files (#10039) out of the Unity Package projects (#9719) and need the dotnet APIs to be linked to a specific version. (In my case that's `netframework-4.8.1`.)

That is
* I currently get the links like this:
* `[object](https://learn.microsoft.com/dotnet/api/system.object)`
* But I need the links with the specified version:
* `[object](https://learn.microsoft.com/dotnet/api/system.object&view=netframework-4.8.1)`

However I could not find the way to achieve this; so I wrote a post-processing logic which finds a pattern match, then replaces strings.

**Describe the solution you'd like**

I would love to have an option that specifies the version of the dotnet API version, which is simply gonna be a query parameter added to the generated URL (`view=netframework-4.8.1`)

* original link: https://learn.microsoft.com/dotnet/api/system.object
* from the config: `dotnetAPIVersion: 'netframework-4.8.1'`
* computed link: https://learn.microsoft.com/dotnet/api/system.object?view=netframework-4.8.1

OR making it possible to format the dotnet API URL string, in the manner of xref template rendering should be nice as well.

* original link: https://learn.microsoft.com/dotnet/api/system.object
* from the config: `dotnetAPILinkTemplate: '{}?view=netframework-4.8.1'`
* computed link: https://learn.microsoft.com/dotnet/api/system.object?view=netframework-4.8.1

**Additional context**

Here's the docfx.json I use.

docfx.json

```json
{
"metadata": [
{
"src": [
{
"src": "..",
"files": [
"**/*.cs"
]
}
],
"dest": "api",
"globalNamespaceId": "Global",
"allowCompilationErrors": true,
"namespaceLayout": "flattened",
"outputFormat": "markdown",
"filter": "filterConfig.yml"
}
]
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.