...
This commit is contained in:
@@ -26,6 +26,7 @@ CopyImages(solutionDir, Path.GetFullPath(Path.Combine(solutionDir, "Web", "wwwro
|
|||||||
var indexJson = BuildIndex(entries);
|
var indexJson = BuildIndex(entries);
|
||||||
File.WriteAllText(Path.Combine(Path.GetDirectoryName(dstDir)!, "notes-index.json"), indexJson);
|
File.WriteAllText(Path.Combine(Path.GetDirectoryName(dstDir)!, "notes-index.json"), indexJson);
|
||||||
GenerateMap(srcDir, Path.GetFullPath(Path.Combine(solutionDir, "Web", "wwwroot", "docs")));
|
GenerateMap(srcDir, Path.GetFullPath(Path.Combine(solutionDir, "Web", "wwwroot", "docs")));
|
||||||
|
GenerateOverviewPage(solutionDir);
|
||||||
|
|
||||||
Console.WriteLine("Done.");
|
Console.WriteLine("Done.");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -137,6 +138,67 @@ static string BuildIndex(List<object> entries)
|
|||||||
return JsonSerializer.Serialize(index, new JsonSerializerOptions { WriteIndented = true });
|
return JsonSerializer.Serialize(index, new JsonSerializerOptions { WriteIndented = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GenerateOverviewPage(string solutionDir)
|
||||||
|
{
|
||||||
|
var pagesDir = Path.GetFullPath(Path.Combine(solutionDir, "Web", "Pages"));
|
||||||
|
Directory.CreateDirectory(pagesDir);
|
||||||
|
|
||||||
|
var component = """
|
||||||
|
@page "/overview"
|
||||||
|
@inject DocsService DocsService
|
||||||
|
|
||||||
|
<PageTitle>Overview</PageTitle>
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="d-flex justify-content-center py-5">
|
||||||
|
<div class="spinner-border text-success" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (doc == null)
|
||||||
|
{
|
||||||
|
<h1>Overview Not Found</h1>
|
||||||
|
<p>The overview document could not be found.</p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="section-header d-flex align-items-center mb-4">
|
||||||
|
<h1 class="mb-0">@doc.Title</h1>
|
||||||
|
<div class="ms-3 flex-grow-1 border-bottom opacity-25"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(doc.FrontmatterHtml))
|
||||||
|
{
|
||||||
|
<details class="frontmatter-section" open>
|
||||||
|
<summary>Frontmatter</summary>
|
||||||
|
@((MarkupString)doc.FrontmatterHtml)
|
||||||
|
</details>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="markdown-body overview-markdown">
|
||||||
|
@((MarkupString)doc.HtmlContent)
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private NoteDocument? doc;
|
||||||
|
private bool loading = true;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
doc = await DocsService.GetNoteAsync("overview");
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
|
var overviewPagePath = Path.Combine(pagesDir, "Overview.razor");
|
||||||
|
File.WriteAllText(overviewPagePath, component);
|
||||||
|
Console.WriteLine($"Overview page written to: {overviewPagePath}");
|
||||||
|
}
|
||||||
|
|
||||||
static void GenerateMap(string srcDir, string dstDir)
|
static void GenerateMap(string srcDir, string dstDir)
|
||||||
{
|
{
|
||||||
var terrainColors = new Dictionary<string, string>
|
var terrainColors = new Dictionary<string, string>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="docs/overview">
|
<NavLink class="nav-link" href="overview">
|
||||||
<span class="bi bi-book-nav-menu" aria-hidden="true"></span> Overview
|
<span class="bi bi-book-nav-menu" aria-hidden="true"></span> Overview
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<h1 class="display-4 mb-3">Earthborne Trailblazer</h1>
|
<h1 class="display-4 mb-3">Earthborne Trailblazer</h1>
|
||||||
<p class="lead mb-4">Your essential companion guide for navigating the Valley and mastering your craft.</p>
|
<p class="lead mb-4">Your essential companion guide for navigating the Valley and mastering your craft.</p>
|
||||||
<div class="hero-actions">
|
<div class="hero-actions">
|
||||||
<NavLink href="docs/overview" class="btn btn-primary btn-lg px-4">Begin Journey</NavLink>
|
<NavLink href="overview" class="btn btn-primary btn-lg px-4">Begin Journey</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
@page "/overview"
|
||||||
|
@inject DocsService DocsService
|
||||||
|
|
||||||
|
<PageTitle>Overview</PageTitle>
|
||||||
|
|
||||||
|
@if (loading)
|
||||||
|
{
|
||||||
|
<div class="d-flex justify-content-center py-5">
|
||||||
|
<div class="spinner-border text-success" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else if (doc == null)
|
||||||
|
{
|
||||||
|
<h1>Overview Not Found</h1>
|
||||||
|
<p>The overview document could not be found.</p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="section-header d-flex align-items-center mb-4">
|
||||||
|
<h1 class="mb-0">@doc.Title</h1>
|
||||||
|
<div class="ms-3 flex-grow-1 border-bottom opacity-25"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(doc.FrontmatterHtml))
|
||||||
|
{
|
||||||
|
<details class="frontmatter-section" open>
|
||||||
|
<summary>Frontmatter</summary>
|
||||||
|
@((MarkupString)doc.FrontmatterHtml)
|
||||||
|
</details>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="markdown-body overview-markdown">
|
||||||
|
@((MarkupString)doc.HtmlContent)
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private NoteDocument? doc;
|
||||||
|
private bool loading = true;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
doc = await DocsService.GetNoteAsync("overview");
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -200,7 +200,7 @@ public class DocsService
|
|||||||
{
|
{
|
||||||
return Regex.Replace(
|
return Regex.Replace(
|
||||||
text,
|
text,
|
||||||
@"\[\[([^\]]+)\]\]",
|
@"(?<!!)\[\[([^\]]+)\]\]",
|
||||||
match =>
|
match =>
|
||||||
{
|
{
|
||||||
var content = match.Groups[1].Value;
|
var content = match.Groups[1].Value;
|
||||||
|
|||||||
Vendored
+10
-8
@@ -102,12 +102,14 @@
|
|||||||
"id": "6cb068dc588aedef",
|
"id": "6cb068dc588aedef",
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "image",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Images/Map.png"
|
"file": "Generate overview page.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
},
|
},
|
||||||
"icon": "lucide-image",
|
"icon": "lucide-file",
|
||||||
"title": "Map"
|
"title": "Generate overview page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -275,13 +277,14 @@
|
|||||||
},
|
},
|
||||||
"active": "6cb068dc588aedef",
|
"active": "6cb068dc588aedef",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Bases/Regions.base",
|
|
||||||
"Tasks.base",
|
"Tasks.base",
|
||||||
|
"Generate overview page.md",
|
||||||
|
"Images/Map.png",
|
||||||
|
"Bases/Regions.base",
|
||||||
"Overview.md",
|
"Overview.md",
|
||||||
"_Tasks.base",
|
"_Tasks.base",
|
||||||
"_Overview.md",
|
"_Overview.md",
|
||||||
"Bases/_Gear.base",
|
"Bases/_Gear.base",
|
||||||
"Images/Map.png",
|
|
||||||
"Notes/White Sky.md",
|
"Notes/White Sky.md",
|
||||||
"Tasks/Generate a csharp script to do what you did.md",
|
"Tasks/Generate a csharp script to do what you did.md",
|
||||||
"Tasks/Generate a Markdown Website.md",
|
"Tasks/Generate a Markdown Website.md",
|
||||||
@@ -318,7 +321,6 @@
|
|||||||
"Notes/Research Station.md",
|
"Notes/Research Station.md",
|
||||||
"Notes/Wasteland.md",
|
"Notes/Wasteland.md",
|
||||||
"Notes/Wasteland 1.md",
|
"Notes/Wasteland 1.md",
|
||||||
"Notes/Mountain 5.md",
|
"Notes/Mountain 5.md"
|
||||||
"Notes/Mountain 4.md"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
category: Task
|
||||||
|
status: Working On
|
||||||
|
---
|
||||||
|
Look at the docs/Overview.md file.
|
||||||
|
|
||||||
|
I want you to create a new script in ET\Console\Program.cs that will make a new page with the href /overview.
|
||||||
|
|
||||||
|
This page will be all the reference markdown files referenced in Overview.md rendered on the page.
|
||||||
|
|
||||||
|
So for ![[Contents]] in the Overview.md page, I want to see all the contents of docs\Notes\Contents.md rendered on that /overview page. i.e. Overview.razor.
|
||||||
|
|
||||||
|
This overview page is just a easy connection of markdown documents for the user to read and get a structured understanding of Earthborne Trailblazer.
|
||||||
|
|
||||||
|
Do not worry about circular references in the documents.
|
||||||
+2
-1
@@ -135,7 +135,8 @@ views:
|
|||||||
cardOrders:
|
cardOrders:
|
||||||
file.file: {}
|
file.file: {}
|
||||||
note.status:
|
note.status:
|
||||||
Working On: []
|
Working On:
|
||||||
|
- Generate overview page.md
|
||||||
Done:
|
Done:
|
||||||
- Tasks/Generate a Markdown Website.md
|
- Tasks/Generate a Markdown Website.md
|
||||||
- Generate a csharp script to do what you did.md
|
- Generate a csharp script to do what you did.md
|
||||||
|
|||||||
Reference in New Issue
Block a user