Ejemplo n.º 1
0
        private static void AddClass(LinkInline link, string cssClass)
        {
            HtmlAttributes attributes = link.GetAttributes();

            if (!attributes.Classes.Any(x => x == cssClass))
            {
                attributes.Classes.Add(cssClass);
                link.SetAttributes(attributes);
            }
        }
Ejemplo n.º 2
0
        private static void AddAttribute(LinkInline link, string name, string value)
        {
            HtmlAttributes attributes = link.GetAttributes();

            if (!attributes.Properties.Any(x => x.Key == name))
            {
                attributes.AddPropertyIfNotExist(name, value);
                link.SetAttributes(attributes);
            }
        }
Ejemplo n.º 3
0
 private void PipelineOnDocumentProcessed(MarkdownDocument document)
 {
     foreach (MarkdownObject node in document.Descendants())
     {
         if (node is Inline)
         {
             LinkInline link = node as LinkInline;
             if (link?.IsImage == true)
             {
                 link.GetAttributes().AddClass(LinkClassToAdd);
             }
         }
     }
 }
Ejemplo n.º 4
0
        private static void EnsureAttributesInLink(LinkInline link)
        {
            HtmlAttributes attributes = link.GetAttributes();

            if (attributes == null)
            {
                attributes         = new HtmlAttributes();
                attributes.Classes = new List <string>();
            }

            if (attributes.Properties == null)
            {
                attributes.Properties = new List <KeyValuePair <string, string> >();
            }

            if (attributes.Classes == null)
            {
                attributes.Classes = new List <string>();
            }
        }