refactor: register markdown pipeline in common lib
This commit is contained in:
parent
ab76264cd0
commit
97466ba84b
|
@ -1,5 +1,4 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using OliverBooth.Common.Data.Blog;
|
||||
using OliverBooth.Common.Data.Web.Users;
|
||||
|
||||
namespace OliverBooth.Api.Data;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using Markdig;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OliverBooth.Common.Data.Blog;
|
||||
using OliverBooth.Common.Data.Web;
|
||||
using OliverBooth.Common.Markdown.Template;
|
||||
using OliverBooth.Common.Services;
|
||||
using X10D.Hosting.DependencyInjection;
|
||||
|
||||
|
@ -17,6 +19,15 @@ public static class DependencyInjectionExtensions
|
|||
/// <param name="collection">The <see cref="IServiceCollection" /> to add the service to.</param>
|
||||
public static void AddCommonServices(this IServiceCollection collection)
|
||||
{
|
||||
collection.AddSingleton(provider => new MarkdownPipelineBuilder()
|
||||
// .Use<TimestampExtension>()
|
||||
.Use(new TemplateExtension(provider.GetRequiredService<ITemplateService>()))
|
||||
.UseAdvancedExtensions()
|
||||
.UseBootstrap()
|
||||
.UseEmojiAndSmiley()
|
||||
.UseSmartyPants()
|
||||
.Build());
|
||||
|
||||
collection.AddDbContextFactory<BlogContext>();
|
||||
collection.AddDbContextFactory<WebContext>();
|
||||
|
||||
|
|
|
@ -3,11 +3,7 @@ using Asp.Versioning;
|
|||
using AspNetCore.ReCaptcha;
|
||||
using FluentFTP;
|
||||
using FluentFTP.Logging;
|
||||
using Markdig;
|
||||
using OliverBooth.Common.Extensions;
|
||||
using OliverBooth.Common.Markdown.Template;
|
||||
using OliverBooth.Common.Services;
|
||||
using OliverBooth.Markdown.Timestamp;
|
||||
using OliverBooth.Services;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
|
@ -25,15 +21,6 @@ builder.Configuration.AddTomlFile("data/config.toml", true, true);
|
|||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddSerilog();
|
||||
|
||||
builder.Services.AddSingleton(provider => new MarkdownPipelineBuilder()
|
||||
.Use<TimestampExtension>()
|
||||
.Use(new TemplateExtension(provider.GetRequiredService<ITemplateService>()))
|
||||
.UseAdvancedExtensions()
|
||||
.UseBootstrap()
|
||||
.UseEmojiAndSmiley()
|
||||
.UseSmartyPants()
|
||||
.Build());
|
||||
|
||||
builder.Services.AddApiVersioning(options =>
|
||||
{
|
||||
options.AssumeDefaultVersionWhenUnspecified = true;
|
||||
|
|
Loading…
Reference in New Issue