mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-11-02 00:16:07 +00:00
Test markdown to html pour la description
This commit is contained in:
parent
ab4758555b
commit
474b879b57
1 changed files with 9 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using AideDeJeuLib.Monsters;
|
using AideDeJeuLib.Monsters;
|
||||||
|
using Markdig;
|
||||||
|
|
||||||
namespace AideDeJeu.Tools
|
namespace AideDeJeu.Tools
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +25,12 @@ namespace AideDeJeu.Tools
|
||||||
return document.ToMonsters();
|
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)
|
public static IEnumerable<Spell> ToSpells(this Markdig.Syntax.MarkdownDocument document)
|
||||||
{
|
{
|
||||||
var spells = new List<Spell>();
|
var spells = new List<Spell>();
|
||||||
|
|
@ -50,7 +57,7 @@ namespace AideDeJeu.Tools
|
||||||
if (block is Markdig.Syntax.ParagraphBlock)
|
if (block is Markdig.Syntax.ParagraphBlock)
|
||||||
{
|
{
|
||||||
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
|
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
|
||||||
spell.DescriptionHtml += paragraphBlock.ToParagraphString();
|
spell.DescriptionHtml += MarkdownToHtml(paragraphBlock.ToParagraphString());
|
||||||
////DumpParagraphBlock(paragraphBlock);
|
////DumpParagraphBlock(paragraphBlock);
|
||||||
//Console.WriteLine(paragraphBlock.IsBreakable);
|
//Console.WriteLine(paragraphBlock.IsBreakable);
|
||||||
//spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString();
|
//spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString();
|
||||||
|
|
@ -131,7 +138,7 @@ namespace AideDeJeu.Tools
|
||||||
if (ininblock is Markdig.Syntax.ParagraphBlock)
|
if (ininblock is Markdig.Syntax.ParagraphBlock)
|
||||||
{
|
{
|
||||||
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
|
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
|
||||||
spell.DescriptionHtml += listBlock.BulletType + " " + paragraphBlock.ToParagraphString();
|
spell.DescriptionHtml += listBlock.BulletType + " " + MarkdownToHtml(paragraphBlock.ToParagraphString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue