feat(Docs) Added FrontMatter and Git edit links

This commit is contained in:
2022-04-11 23:31:23 -04:00
parent ddb6318186
commit 1939bbe70a
31 changed files with 254 additions and 299 deletions
+26 -10
View File
@@ -8,14 +8,14 @@ else
{
<div class="note">
<div class="noteHeader">
<div class="noteTitle">@NoteContentModel.Name</div>
<div class="noteTitle">@noteFrontMatter.Title</div>
<div class="noteDates">
<div class="noteDateUpdated"><b>Updated</b>: @NoteContentModel.UpdatedDate.ToString("MM/dd/yyyy")</div>
<div class="noteDateCreated"><b>Created</b>: @NoteContentModel.CreatedDate.ToString("MM/dd/yyyy")</div>
<div class="noteDateUpdated"><b>Updated</b>: @noteFrontMatter.UpdatedDate.ToString("MM/dd/yyyy")</div>
<div class="noteDateCreated"><b>Created</b>: @noteFrontMatter.CreatedDate.ToString("MM/dd/yyyy")</div>
</div>
</div>
<div class="noteContent">@((MarkupString)Markdown.ToHtml(content, pipeline))</div>
<div class="noteContent">@((MarkupString)Markdown.ToHtml(content, Pipeline))</div>
<div class="noteFooter"><EditLinkComponent Href="@GitUrl"></EditLinkComponent></div>
</div>
}
@@ -34,15 +34,31 @@ else
flex-direction: column;
}
.noteFooter {
display: flex;
justify-content: flex-end;
}
</style>
@code {
[Parameter]
public NoteContentModel NoteContentModel { get; set; } = default!;
[Parameter] public NoteContentModel NoteContentModel { get; set; } = default!;
NoteFrontMatterModel noteFrontMatter = null!;
private string? content = null;
string? content = null;
MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
private async Task<string> LoadContent() => content = await httpClient.GetStringAsync($"content/notes/{NoteContentModel.Content}.md");
private string Filepath => $"content/notes/{NoteContentModel.Content}.md";
private string GitUrl => $"{Project.GitResourcesUrl}/{Filepath}";
private MarkdownPipeline Pipeline => MarkdownFiles.Pipeline;
private async Task<NoteFrontMatterModel> LoadContent() {
content = await MarkdownFiles.LoadMarkdown(httpClient, Filepath);
return noteFrontMatter =
await MarkdownFiles.LoadFrontMatter<NoteFrontMatterModel>(httpClient, Filepath);
}
protected override async Task OnParametersSetAsync() => await LoadContent();
protected override async Task OnInitializedAsync() => await LoadContent();
+3 -2
View File
@@ -11,8 +11,9 @@
<style>
.noteNavContainer {
display: flex;
flex-direction: column;
display: flex;
flex-direction: column;
gap: 8px;
}
.noteNavButton a {