Tidy up BlogViewModel
This commit is contained in:
parent
323f47fc5b
commit
47431d4650
1 changed files with 12 additions and 12 deletions
|
@ -15,7 +15,7 @@ namespace Website.ViewModels
|
|||
Content = blogPost.Content;
|
||||
}
|
||||
|
||||
string GetDaySuffix(int day) {
|
||||
private static string GetDaySuffix(int day) {
|
||||
switch (day) {
|
||||
case 1:
|
||||
case 21:
|
||||
|
@ -32,22 +32,22 @@ namespace Website.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private string FormatTimestamp(DateTime timestamp) {
|
||||
private static string FormatTimestamp(DateTime timestamp) {
|
||||
var suffix = GetDaySuffix(timestamp.Day);
|
||||
return timestamp.ToString($@"dddd \t\h\e d{suffix} \o\f MMMM yyyy");
|
||||
}
|
||||
|
||||
protected MarkdownPipeline GetPipeline()=>new MarkdownPipelineBuilder()
|
||||
//.UseAdvancedExtensions()
|
||||
.UseAutoLinks()
|
||||
.UseSoftlineBreakAsHardlineBreak()
|
||||
.UseSyntaxHighlighting()
|
||||
.Build();
|
||||
private static MarkdownPipeline GetPipeline() => new MarkdownPipelineBuilder()
|
||||
//.UseAdvancedExtensions()
|
||||
.UseAutoLinks()
|
||||
.UseSoftlineBreakAsHardlineBreak()
|
||||
.UseSyntaxHighlighting()
|
||||
.Build();
|
||||
|
||||
public string Title { get; private set; }
|
||||
public string Title { get; }
|
||||
public string Content { get; protected set; }
|
||||
public string Timestamp { get; private set; }
|
||||
public string Url { get; private set; }
|
||||
public object ContentHtml => Markdown.ToHtml(Content, GetPipeline()).Trim();
|
||||
public string Timestamp { get; }
|
||||
public string Url { get; }
|
||||
public string ContentHtml => Markdown.ToHtml(Content, GetPipeline()).Trim();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue