feat(Docs) Added FrontMatter and Git edit links
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user