1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00

Test markdown to html pour la description

This commit is contained in:
Yan Maniez 2018-06-13 20:43:49 +02:00
parent ab4758555b
commit 474b879b57

View file

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Linq;
using System.Diagnostics;
using AideDeJeuLib.Monsters;
using Markdig;
namespace AideDeJeu.Tools
{
@ -24,6 +25,12 @@ namespace AideDeJeu.Tools
return document.ToMonsters();
}
public static string MarkdownToHtml(string md)
{
var pipeline = new MarkdownPipelineBuilder().UsePipeTables().Build();
return Markdown.ToHtml(md, pipeline);
}
public static IEnumerable<Spell> ToSpells(this Markdig.Syntax.MarkdownDocument document)
{
var spells = new List<Spell>();
@ -50,7 +57,7 @@ namespace AideDeJeu.Tools
if (block is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
spell.DescriptionHtml += paragraphBlock.ToParagraphString();
spell.DescriptionHtml += MarkdownToHtml(paragraphBlock.ToParagraphString());
////DumpParagraphBlock(paragraphBlock);
//Console.WriteLine(paragraphBlock.IsBreakable);
//spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString();
@ -131,7 +138,7 @@ namespace AideDeJeu.Tools
if (ininblock is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
spell.DescriptionHtml += listBlock.BulletType + " " + paragraphBlock.ToParagraphString();
spell.DescriptionHtml += listBlock.BulletType + " " + MarkdownToHtml(paragraphBlock.ToParagraphString());
}
}
}