Skip to content

Commit

Permalink
feat: adjust .NET API display for modern template (#8525)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih authored Mar 20, 2023
1 parent cb560e4 commit 9a8a2ab
Show file tree
Hide file tree
Showing 74 changed files with 1,193 additions and 845 deletions.
1 change: 1 addition & 0 deletions templates/default/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"improveThisDoc": "Improve this Doc",
"viewSource": "View Source",
"inheritance": "Inheritance",
"derived": "Derived",
"inheritedMembers": "Inherited Members",
"package": "Package",
"namespace": "Namespace",
Expand Down
3 changes: 1 addition & 2 deletions templates/modern/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta name="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#docurl}}<meta name="docfx:docurl" content="{{docurl}}">{{/docurl}}
{{#yamlmime}}<meta name="docfx:yamlmime" content="{{yamlmime}}">{{/yamlmime}}
{{/redirect_url}}
</head>

{{^redirect_url}}
<body data-layout="{{layout}}">
<body data-layout="{{layout}}" data-yaml-mime="{{yamlmime}}">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
Expand Down
156 changes: 156 additions & 0 deletions templates/modern/partials/class.header.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">
{{>partials/title}}
{{#sourceurl}}<a class="header-action link-secondary" title="View source" href="{{sourceurl}}"><i class="bi bi-code-slash"></i></a>{{/sourceurl}}
</h1>

<div class="facts text-secondary">
<dl><dt>{{__global.namespace}}</dt><dd>{{{namespace.specName.0.value}}}</dd></dl>
<dl><dt>{{__global.assembly}}</dt><dd>{{assemblies.0}}.dll</dd></dl>
</div>

<div class="markdown summary">{{{summary}}}</div>
<div class="markdown conceptual">{{{conceptual}}}</div>

<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>
</div>

{{#syntax.parameters.0}}
<h4 class="section">{{__global.parameters}}</h4>
<dl class="parameters">
{{/syntax.parameters.0}}
{{#syntax.parameters}}
<dt><code>{{{id}}}</code> {{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
{{/syntax.parameters}}
{{#syntax.parameters.0}}
</dl>
{{/syntax.parameters.0}}

{{#syntax.return}}
<h4 class="section">{{__global.returns}}</h4>
<dl class="parameters">
<dt>type.specName.0.value</dt>
<dd>{{{description}}}</dd>
</dl>
{{/syntax.return}}

{{#syntax.typeParameters.0}}
<h4 class="section">{{__global.typeParameters}}</h4>
<dl class="parameters">
{{/syntax.typeParameters.0}}
{{#syntax.typeParameters}}
<dt><code>{{{id}}}</code></dt>
<dd>{{{description}}}</dd>
{{/syntax.typeParameters}}
{{#syntax.typeParameters.0}}
</dl>
{{/syntax.typeParameters.0}}

{{#inClass}}
{{#inheritance.0}}
<dl class="typelist inheritance">
<dt>{{__global.inheritance}}</dt>
<dd>
{{/inheritance.0}}
{{#inheritance}}
<div>{{{specName.0.value}}}</div>
{{/inheritance}}
<div><span class="xref">{{name.0.value}}</span></div>
{{#inheritance.0}}
</dd>
</dl>
{{/inheritance.0}}
{{/inClass}}

{{#implements.0}}
<dl class="typelist implements">
<dt>{{__global.implements}}</dt>
<dd>
{{/implements.0}}
{{#implements}}
<div>{{{specName.0.value}}}</div>
{{/implements}}
{{#implements.0}}
</dd>
</dl>
{{/implements.0}}

{{#inClass}}
{{#derivedClasses.0}}
<dl class="typelist derived">
<dt>{{__global.derived}}</dt>
<dd>
{{/derivedClasses.0}}
{{#derivedClasses}}
<div>{{{specName.0.value}}}</div>
{{/derivedClasses}}
{{#derivedClasses.0}}
</dd>
</dl>
{{/derivedClasses.0}}
{{/inClass}}

{{#inheritedMembers.0}}
<dl class="typelist derived">
<dt>{{__global.inheritedMembers}}</dt>
<dd>
{{/inheritedMembers.0}}
{{#inheritedMembers}}
<div>
{{#definition}}
<xref uid="{{definition}}" text="{{nameWithType.0.value}}" alt="{{fullName.0.value}}"/>
{{/definition}}
{{^definition}}
<xref uid="{{uid}}" text="{{nameWithType.0.value}}" alt="{{fullName.0.value}}"/>
{{/definition}}
</div>
{{/inheritedMembers}}
{{#inheritedMembers.0}}
</dl>
{{/inheritedMembers.0}}

{{#extensionMethods.0}}
<dl class="typelist extensionMethods">
<dt>{{__global.extensionMethods}}</dt>
<dd>
{{/extensionMethods.0}}
{{#extensionMethods}}
<div>
{{#definition}}
<xref uid="{{definition}}" altProperty="fullName" displayProperty="nameWithType"/>
{{/definition}}
{{^definition}}
<xref uid="{{uid}}" altProperty="fullName" displayProperty="nameWithType"/>
{{/definition}}
</div>
{{/extensionMethods}}
{{#extensionMethods.0}}
</dl>
{{/extensionMethods.0}}

{{#isEnum}}
{{#children}}
<h2 id="{{id}}">{{>partials/classSubtitle}}</h2>
<dl class="parameters">
{{#children}}
<dt id="{{id}}"><code>{{syntax.content.0.value}}</code></dt>
<dd>{{{summary}}}</dd>
{{/children}}
</dl>
{{/children}}
{{/isEnum}}

{{#example.0}}
<h2 id="{{id}}_examples">{{__global.examples}}</h2>
{{/example.0}}
{{#example}}
{{{.}}}
{{/example}}

{{#remarks}}
<h2 id="{{id}}_remarks">{{__global.remarks}}</h2>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{/remarks}}
145 changes: 145 additions & 0 deletions templates/modern/partials/class.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

{{>partials/class.header}}

{{#children}}
<h2 class="section" id="{{id}}">{{>partials/classSubtitle}}</h2>
{{#children}}

{{#overload}}
<a id="{{id}}" data-uid="{{uid}}"></a>
{{/overload}}

<h3 id="{{id}}" data-uid="{{uid}}">
{{name.0.value}}
{{#sourceurl}}<a class="header-action link-secondary" title="View source" href="{{sourceurl}}"><i class="bi bi-code-slash"></i></a>{{/sourceurl}}
</h3>

<div class="markdown level1 summary">{{{summary}}}</div>
<div class="markdown level1 conceptual">{{{conceptual}}}</div>

{{#syntax}}
<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>
</div>

{{#syntax.parameters.0}}
<h4 class="section">{{__global.parameters}}</h4>
<dl class="parameters">
{{/syntax.parameters.0}}
{{#syntax.parameters}}
<dt><code>{{{id}}}</code> {{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
{{/syntax.parameters}}
{{#syntax.parameters.0}}
</dl>
{{/syntax.parameters.0}}

{{#syntax.return}}
<h4 class="section">{{__global.returns}}</h4>
<dl class="parameters">
<dt>{{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
</dl>
{{/syntax.return}}

{{#syntax.typeParameters.0}}
<h4 class="section">{{__global.typeParameters}}</h4>
<dl class="parameters">
{{/syntax.typeParameters.0}}
{{#syntax.typeParameters}}
<dt><code>{{{id}}}</code></dt>
<dd>{{{description}}}</dd>
{{/syntax.typeParameters}}
{{#syntax.typeParameters.0}}
</dl>
{{/syntax.typeParameters.0}}

{{#fieldValue}}
<h4 class="section">{{__global.fieldValue}}</h4>
<dl class="parameters">
<dt>{{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
</dl>
{{/fieldValue}}

{{#propertyValue}}
<h4 class="section">{{__global.propertyValue}}</h4>
<dl class="parameters">
<dt>{{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
</dl>
{{/propertyValue}}

{{#eventType}}
<h4 class="section">{{__global.eventType}}</h4>
<dl class="parameters">
<dt>{{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
</dl>
{{/eventType}}

{{/syntax}}

{{#example.0}}
<h4 class="section" id="{{id}}_examples">{{__global.examples}}</h4>
{{/example.0}}
{{#example}}
{{{.}}}
{{/example}}

{{#remarks}}
<h4 class="section" id="{{id}}_remarks">{{__global.remarks}}</h4>
<div class="markdown level1 remarks">{{{remarks}}}</div>
{{/remarks}}

{{#exceptions.0}}
<h4 class="section">{{__global.exceptions}}</h4>
<dl class="parameters">
{{/exceptions.0}}
{{#exceptions}}
<dt>{{{type.specName.0.value}}}</dt>
<dd>{{{description}}}</dd>
{{/exceptions}}
{{#exceptions.0}}
</dl>
{{/exceptions.0}}

{{#seealso.0}}
<dl class="typelist seealso">
<dt>{{__global.seealso}}</dt>
<dd>
{{/seealso.0}}
{{#seealso}}
<div>
{{#isCref}}
<div>{{{type.specName.0.value}}}</div>
{{/isCref}}
{{^isCref}}
<div>{{{url}}}</div>
{{/isCref}}
</div>
{{/seealso}}
{{#seealso.0}}
</dd>
</dl>
{{/seealso.0}}

{{/children}}
{{/children}}

{{#seealso.0}}
<h2 id="seealso">{{__global.seealso}}</h2>
<div class="seealso">
{{/seealso.0}}
{{#seealso}}
{{#isCref}}
<div>{{{type.specName.0.value}}}</div>
{{/isCref}}
{{^isCref}}
<div>{{{url}}}</div>
{{/isCref}}
{{/seealso}}
{{#seealso.0}}
</div>
{{/seealso.0}}
19 changes: 19 additions & 0 deletions templates/modern/partials/enum.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

{{>partials/class.header}}

{{#seealso.0}}
<h2 id="seealso">{{__global.seealso}}</h2>
<div class="seealso">
{{/seealso.0}}
{{#seealso}}
{{#isCref}}
<div>{{{type.specName.0.value}}}</div>
{{/isCref}}
{{^isCref}}
<div>{{{url}}}</div>
{{/isCref}}
{{/seealso}}
{{#seealso.0}}
</div>
{{/seealso.0}}
16 changes: 16 additions & 0 deletions templates/modern/partials/namespace.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
<div class="markdown level0 remarks">{{{remarks}}}</div>

{{#children}}
<h3 id="{{id}}">{{>partials/namespaceSubtitle}}</h3>
{{#children}}
<dl class="jumplist">
<dt><xref uid="{{uid}}" altProperty="fullName" displayProperty="name"/></dt>
<dd>{{{summary}}}</dd>
</dl>
{{/children}}
{{/children}}
7 changes: 2 additions & 5 deletions templates/modern/src/docfx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ h6,
}

article {
// For REST API view source link
span.small.pull-right {
float: right;
}

section {
margin-left: 1em;
}


img {
max-width: 100%;
height: auto;
Expand Down
Loading

0 comments on commit 9a8a2ab

Please sign in to comment.