dotnet / dotnet/docfx

[Bug] Markdown Metadata Output For Generic Classes Doesn't Show Derived Section

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

Description

**Describe the bug**
Not sure why, but the markdown metadata output format doesn't seem to include a Derived section on pages that happen to be generic, even though they would be listed in the yaml counterpart.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a dummy project with a generic base class and one or more derived classes, e.g.:
```csharp
namespace DocFXTest;
public class GenericBaseClass
{
}

public class GenericDerivedClass : GenericBaseClass
{
}
```
2. Run DocFX with a minimal config for the project, i.e.:
```
{
"metadata": [
{
"src": [
...
],
"dest": ...
}
]
}
```
4. Observe that the `derivedClasses` section is present in `DocFXTest.GenericBaseClass-1.yml:`
```
...
derivedClasses:
- DocFxTest.GenericDerivedClass`1
...
```
5. Modify the config to make the outputFormat markdown:
```
{
"metadata": [
{
...
"outputFormat": "markdown"
}
]
}
```
6. Run DocFX again.
**Expected behavior**
One of the resulting files, `DocFXTest.GenericBaseClass-1.md`, should have a `Derived` section, i.e.:
```
...
#### Derived
[GenericDerivedClass](DocFxTest.GenericDerivedClass\-1.md)
...
```

**Actual behavior**
`DocFXTest.GenericBaseClass-1.md`, does not have a `Derived` section, i.e.:
````
# Class GenericBaseClass

Namespace: [DocFxTest](DocFxTest.md)
Assembly: DocFxTest.dll

```csharp
public class GenericBaseClass
```

#### Type Parameters

`T`

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[GenericBaseClass](DocFxTest.GenericBaseClass\-1.md)

#### Inherited Members

[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
````

**Context (please complete the following information):**
- Docfx version: 2.77.0
- Template: markdown (api output format)

**Additional context**
The trigger condition appears to be the base class that is generic, and only that page is affected. Non-generic base classes will include a `#### Derived` section.

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.