Docs redesign (#728)

* Adding a dark mode
* Adding reference for types to summary pages
* Adding API Reference
* Adding modifiers to methods/fields/etc
* Minimizing files input
* Caching a lot of the output pages
* Cache only for each execution
* Adding API references to existing docs
This commit is contained in:
Phil Scott
2022-02-14 12:44:25 -05:00
committed by GitHub
parent 74a2e10ff0
commit c2da268129
147 changed files with 4112 additions and 6897 deletions

View File

@ -1,6 +1,5 @@
using System.Collections.Generic;
using Statiq.Common;
using System.Xml.Linq;
namespace Docs.Shortcodes
{
@ -8,7 +7,6 @@ namespace Docs.Shortcodes
{
public override ShortcodeResult Execute(KeyValuePair<string, string>[] args, string content, IDocument document, IExecutionContext context)
{
return $"<div class=\"alert-warning\">{content}</div>";
}
}

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using Statiq.Common;
using System.Xml.Linq;
using Docs.Extensions;
namespace Docs.Shortcodes
{

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Statiq.Common;
@ -10,8 +9,6 @@ namespace Docs.Shortcodes
{
public class ColorTableShortcode : SyncShortcode
{
private const string ColorStyle = "display: inline-block;width: 60px; height: 15px;";
public override ShortcodeResult Execute(KeyValuePair<string, string>[] args, string content, IDocument document, IExecutionContext context)
{
// Get the definition.

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Statiq.Common;
@ -31,7 +30,6 @@ namespace Docs.Shortcodes
foreach (var emoji in emojis)
{
var code = emoji.Code.Replace("U+0000", "U+").Replace("U+000", "U+");
var icon = $"&#x{emoji.Code.Replace("U+", string.Empty)};";
var row = new XElement("tr", new XAttribute("class", "search-row"));

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Docs.Extensions;
using Docs.Utilities;
using Microsoft.CodeAnalysis;
using Statiq.CodeAnalysis;
using Statiq.Common;
namespace Docs.Shortcodes;
public class ExampleSnippet : Shortcode
{
protected const string Solution = nameof(Solution);
protected const string Project = nameof(Project);
protected const string Symbol = nameof(Symbol);
protected const string BodyOnly = nameof(BodyOnly);
public override async Task<ShortcodeResult> ExecuteAsync(KeyValuePair<string, string>[] args, string content,
IDocument document, IExecutionContext context)
{
var props = args.ToDictionary(Solution, Project, Symbol, BodyOnly);
var symbolName = props.GetString(Symbol);
var bodyOnly = props.Get<bool?>(BodyOnly) ?? symbolName.StartsWith("m:", StringComparison.InvariantCultureIgnoreCase);
if (!context.TryGetCommentIdDocument(symbolName, out var apiDocument, out _))
{
return string.Empty;
}
var options = HighlightService.HighlightOption.All;
if (bodyOnly)
{
options = HighlightService.HighlightOption.Body;
}
var comp = apiDocument.Get<Compilation>(CodeAnalysisKeys.Compilation);
var symbol = apiDocument.Get<ISymbol>(CodeAnalysisKeys.Symbol);
var highlightElement = await HighlightService.Highlight(comp, symbol, options);
ShortcodeResult shortcodeResult = $"<pre><code>{highlightElement}</code></pre>";
return shortcodeResult;
}
}