Org Markdown : Markdig
All checks were successful
Dotnet build and test / build (pull_request) Successful in 6m22s
All checks were successful
Dotnet build and test / build (pull_request) Successful in 6m22s
This commit is contained in:
parent
44f0664a5d
commit
827cf7d2a3
7 changed files with 55 additions and 31 deletions
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
using System.Web;
|
||||
using AsciiDocSharp;
|
||||
using AsciiDocSharp.Converters.Html;
|
||||
using Markdig;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
public class AsciidocTagHelper : TagHelper
|
||||
public class MarkdownTagHelper : TagHelper
|
||||
{
|
||||
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
|
|
@ -18,6 +17,7 @@ namespace Yavsc.Helpers
|
|||
|
||||
if (string.IsNullOrWhiteSpace(text)) return;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (context.AllAttributes.ContainsName("summary"))
|
||||
|
|
@ -34,16 +34,10 @@ namespace Yavsc.Helpers
|
|||
}
|
||||
}
|
||||
}
|
||||
var processor = new AsciiDocProcessor(
|
||||
|
||||
);
|
||||
var htmlConverter = new HtmlDocumentConverter();
|
||||
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
|
||||
var result = Markdown.ToHtml(text, pipeline);
|
||||
|
||||
var document = processor.ParseFromText(text);
|
||||
var htmlResult = processor.ConvertDocument(document, htmlConverter);
|
||||
|
||||
|
||||
output.Content.AppendHtml(htmlResult);
|
||||
output.Content.AppendHtml(result);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue