New doc theme (#387)

This commit is contained in:
Phil Scott
2021-04-24 16:20:59 -04:00
committed by GitHub
parent b568098d5e
commit 2a9fbb1ee9
145 changed files with 197984 additions and 8746 deletions

View File

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

View File

@ -22,24 +22,27 @@ namespace Docs.Shortcodes
// Headers
var table = new XElement("table", new XAttribute("class", "table"), new XAttribute("id", "color-results"));
var tHead = new XElement("thead");
var header = new XElement("tr", new XAttribute("class", "color-row"));
header.Add(new XElement("th", ""));
header.Add(new XElement("th", "#"));
header.Add(new XElement("th", "#", new XAttribute("class", "hidden md:table-cell")));
header.Add(new XElement("th", "Name"));
header.Add(new XElement("th", "RGB"));
header.Add(new XElement("th", "RGB", new XAttribute("class", "hidden md:table-cell")));
header.Add(new XElement("th", "Hex"));
header.Add(new XElement("th", "System.ConsoleColor"));
table.Add(header);
header.Add(new XElement("th", new XElement("span", "System.ConsoleColor"), new XAttribute("class", "break-all")));
tHead.Add(header);
table.Add(tHead);
var tBody = new XElement("tbody");
foreach (var color in colors)
{
var rep = new XElement("td",
new XElement("span",
new XAttribute("class", "color-representation"),
new XAttribute("class", "inline-block w-4 md:w-16 h-4 border border-black border-opacity-75 rounded"),
new XAttribute("style", $"background-color:{color.Hex};")));
var name = new XElement("td", new XElement("code", color.Number.ToString()));
var name = new XElement("td", new XElement("code", color.Number.ToString()), new XAttribute("class", "hidden md:table-cell"));
var number = new XElement("td", new XElement("code", color.Name.ToLower()));
var rgb = new XElement("td", new XElement("code", $"{color.R},{color.G},{color.B}"));
var rgb = new XElement("td", new XElement("code", $"{color.R},{color.G},{color.B}"), new XAttribute("class", "hidden md:table-cell"));
var hex = new XElement("td", new XElement("code", color.Hex));
var clr = new XElement("td", new XElement("code", color.ClrName));
@ -51,9 +54,10 @@ namespace Docs.Shortcodes
row.Add(rgb);
row.Add(hex);
row.Add(clr);
table.Add(row);
tBody.Add(row);
}
table.Add(tBody);
return table.ToString();
}
}

View File

@ -19,11 +19,15 @@ namespace Docs.Shortcodes
// Headers
var table = new XElement("table", new XAttribute("class", "table"), new XAttribute("id", "emoji-results"));
var tHead = new XElement("thead");
var header = new XElement("tr", new XAttribute("class", "emoji-row-header"));
header.Add(new XElement("th", ""));
header.Add(new XElement("th", "Markup"));
header.Add(new XElement("th", "Constant"));
table.Add(header);
header.Add(new XElement("th", "Constant", new XAttribute("class", "hidden md:table-cell")));
tHead.Add(header);
table.Add(tHead);
var tBody = new XElement("tbody");
foreach (var emoji in emojis)
{
@ -33,11 +37,13 @@ namespace Docs.Shortcodes
var row = new XElement("tr", new XAttribute("class", "search-row"));
row.Add(new XElement("td", icon));
row.Add(new XElement("td", new XElement("code", $":{emoji.Id}:")));
row.Add(new XElement("td", new XElement("code", emoji.Name)));
row.Add(new XElement("td", new XElement("code", emoji.Name), new XAttribute("class", "hidden md:table-cell")));
table.Add(row);
tBody.Add(row);
}
table.Add(tBody);
return table.ToString()
.Replace("&amp;#x", "&#x");
}