diff --git a/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs b/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs index c1fefa30..1f4e83f7 100644 --- a/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs +++ b/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs @@ -10,6 +10,8 @@ using AideDeJeuLib.Monsters; using Markdig; using AideDeJeuLib; using AideDeJeuLib.Conditions; +using Markdig.Syntax; +using Markdig.Syntax.Inlines; namespace AideDeJeu.Tools { @@ -54,7 +56,26 @@ namespace AideDeJeu.Tools enumerator.MoveNext(); while (enumerator.Current != null) { - if(enumerator.Current is Markdig.Syntax.LinkReferenceDefinitionGroup) + if (enumerator.Current is Markdig.Syntax.ParagraphBlock) + { + var paragraphBlock = enumerator.Current as ParagraphBlock; + var linkInline = paragraphBlock.Inline.FirstChild as LinkInline; + if(linkInline != null) + { + var label = linkInline.Label; + var title = linkInline.Title; + var url = linkInline.Url; + if (title == "") + { + var name = $"AideDeJeuLib.{label}, AideDeJeu"; + var type = Type.GetType(name); + var instance = Activator.CreateInstance(type) as Item; + instance.Parse(ref enumerator); + return instance; + } + } + } + if (enumerator.Current is Markdig.Syntax.LinkReferenceDefinitionGroup) { var linkReferenceDefinitionGroup = enumerator.Current as Markdig.Syntax.LinkReferenceDefinitionGroup; var linkReferenceDefinition = linkReferenceDefinitionGroup.FirstOrDefault() as Markdig.Syntax.LinkReferenceDefinition; diff --git a/Data/spells_hd.md b/Data/spells_hd.md index f6e3f250..fa5342c6 100644 --- a/Data/spells_hd.md +++ b/Data/spells_hd.md @@ -1,8 +1,9 @@  -[//]: # (Items) +[][Items] [][SpellHD] +[Items]: #Items [SpellHD]: #SpellHD # Agrandir/rétrécir