Skip to content

Commit

Permalink
API page
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Jan 13, 2024
1 parent bc94d75 commit 6fb45cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Docfx.Build/ApiPage/ApiPageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ public FileModel Load(FileAndType file, ImmutableDictionary<string, object> meta
var yml = EnvironmentContext.FileAbstractLayer.ReadAllText(file.File);
var json = JsonSerializer.Serialize(deserializer.Deserialize<object>(yml));
var data = JsonSerializer.Deserialize<ApiPage>(json, ApiPage.JsonSerializerOptions);
var content = new Dictionary<string, object>(metadata.OrderBy(item => item.Key))
var content = new Dictionary<string, object>(metadata.OrderBy(item => item.Key));

if (data.metadata is not null)
{
["title"] = data.title,
["content"] = ApiPageHtmlTemplate.Render(data, Markup).ToString(),
["yamlmime"] = "ApiPage",
["_disableNextArticle"] = true,
};
foreach (var (key, value) in data.metadata.OrderBy(item => item.Key))
content[key] = value.Value;
}

content["title"] = data.title;
content["content"] = ApiPageHtmlTemplate.Render(data, Markup).ToString();
content["yamlmime"] = "ApiPage";
content["_disableNextArticle"] = true;

var localPathFromRoot = PathUtility.MakeRelativePath(EnvironmentContext.BaseDirectory, EnvironmentContext.FileAbstractLayer.GetPhysicalPath(file.File));

Expand Down
1 change: 1 addition & 0 deletions src/Docfx.Dotnet/Docfx.Dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" />
<PackageReference Include="ICSharpCode.Decompiler" />
<PackageReference Include="IgnoresAccessChecksToGenerator" PrivateAssets="All" />
<PackageReference Include="OneOf" />
Expand Down

0 comments on commit 6fb45cc

Please sign in to comment.