diff --git a/ET/Console/Program.cs b/ET/Console/Program.cs index fa4a099..55c227e 100644 --- a/ET/Console/Program.cs +++ b/ET/Console/Program.cs @@ -26,6 +26,7 @@ CopyImages(solutionDir, Path.GetFullPath(Path.Combine(solutionDir, "Web", "wwwro var indexJson = BuildIndex(entries); File.WriteAllText(Path.Combine(Path.GetDirectoryName(dstDir)!, "notes-index.json"), indexJson); GenerateMap(srcDir, Path.GetFullPath(Path.Combine(solutionDir, "Web", "wwwroot", "docs"))); +GenerateOverviewPage(solutionDir); Console.WriteLine("Done."); return 0; @@ -137,6 +138,67 @@ static string BuildIndex(List entries) 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 + +Overview + +@if (loading) +{ +
+
+ Loading... +
+
+} +else if (doc == null) +{ +

Overview Not Found

+

The overview document could not be found.

+} +else +{ +
+

@doc.Title

+
+
+ + @if (!string.IsNullOrEmpty(doc.FrontmatterHtml)) + { +
+ Frontmatter + @((MarkupString)doc.FrontmatterHtml) +
+ } + +
+ @((MarkupString)doc.HtmlContent) +
+} + +@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) { var terrainColors = new Dictionary @@ -314,4 +376,4 @@ internal class RegionData public int Y { get; set; } public List Connections { get; set; } = new(); public List Landmarks { get; set; } = new(); -} \ No newline at end of file +} diff --git a/ET/Web/Layout/NavMenu.razor b/ET/Web/Layout/NavMenu.razor index c8fbce2..1fe0b75 100644 --- a/ET/Web/Layout/NavMenu.razor +++ b/ET/Web/Layout/NavMenu.razor @@ -19,7 +19,7 @@ diff --git a/ET/Web/Pages/Home.razor b/ET/Web/Pages/Home.razor index 371fc5c..f98b1c8 100644 --- a/ET/Web/Pages/Home.razor +++ b/ET/Web/Pages/Home.razor @@ -7,7 +7,7 @@

Earthborne Trailblazer

Your essential companion guide for navigating the Valley and mastering your craft.

- Begin Journey + Begin Journey
diff --git a/ET/Web/Pages/Overview.razor b/ET/Web/Pages/Overview.razor new file mode 100644 index 0000000..e9d873d --- /dev/null +++ b/ET/Web/Pages/Overview.razor @@ -0,0 +1,48 @@ +@page "/overview" +@inject DocsService DocsService + +Overview + +@if (loading) +{ +
+
+ Loading... +
+
+} +else if (doc == null) +{ +

Overview Not Found

+

The overview document could not be found.

+} +else +{ +
+

@doc.Title

+
+
+ + @if (!string.IsNullOrEmpty(doc.FrontmatterHtml)) + { +
+ Frontmatter + @((MarkupString)doc.FrontmatterHtml) +
+ } + +
+ @((MarkupString)doc.HtmlContent) +
+} + +@code { + private NoteDocument? doc; + private bool loading = true; + + protected override async Task OnInitializedAsync() + { + doc = await DocsService.GetNoteAsync("overview"); + loading = false; + } +} \ No newline at end of file diff --git a/ET/Web/Services/DocsService.cs b/ET/Web/Services/DocsService.cs index be2d322..f1c3275 100644 --- a/ET/Web/Services/DocsService.cs +++ b/ET/Web/Services/DocsService.cs @@ -200,7 +200,7 @@ public class DocsService { return Regex.Replace( text, - @"\[\[([^\]]+)\]\]", + @"(? { var content = match.Groups[1].Value; diff --git a/docs/.obsidian/workspace.json b/docs/.obsidian/workspace.json index 1a6bd9c..f3869e7 100644 --- a/docs/.obsidian/workspace.json +++ b/docs/.obsidian/workspace.json @@ -102,12 +102,14 @@ "id": "6cb068dc588aedef", "type": "leaf", "state": { - "type": "image", + "type": "markdown", "state": { - "file": "Images/Map.png" + "file": "Generate overview page.md", + "mode": "source", + "source": false }, - "icon": "lucide-image", - "title": "Map" + "icon": "lucide-file", + "title": "Generate overview page" } } ], @@ -275,13 +277,14 @@ }, "active": "6cb068dc588aedef", "lastOpenFiles": [ - "Bases/Regions.base", "Tasks.base", + "Generate overview page.md", + "Images/Map.png", + "Bases/Regions.base", "Overview.md", "_Tasks.base", "_Overview.md", "Bases/_Gear.base", - "Images/Map.png", "Notes/White Sky.md", "Tasks/Generate a csharp script to do what you did.md", "Tasks/Generate a Markdown Website.md", @@ -318,7 +321,6 @@ "Notes/Research Station.md", "Notes/Wasteland.md", "Notes/Wasteland 1.md", - "Notes/Mountain 5.md", - "Notes/Mountain 4.md" + "Notes/Mountain 5.md" ] } \ No newline at end of file diff --git a/docs/Generate overview page.md b/docs/Generate overview page.md new file mode 100644 index 0000000..06d26cb --- /dev/null +++ b/docs/Generate overview page.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. \ No newline at end of file diff --git a/docs/Tasks.base b/docs/Tasks.base index 70448bd..34ab72e 100644 --- a/docs/Tasks.base +++ b/docs/Tasks.base @@ -135,7 +135,8 @@ views: cardOrders: file.file: {} note.status: - Working On: [] + Working On: + - Generate overview page.md Done: - Tasks/Generate a Markdown Website.md - Generate a csharp script to do what you did.md