/// <summary> /// Gets or creates the <see cref="HtmlAttributes"/> stored on a <see cref="MarkdownObject"/> /// </summary> /// <param name="obj">The markdown object.</param> /// <returns>The attached html attributes</returns> public static HtmlAttributes GetAttributes(this IMarkdownObject obj) { var attributes = obj.GetData(Key) as HtmlAttributes; if (attributes == null) { attributes = new HtmlAttributes(); obj.SetAttributes(attributes); } return(attributes); }
/// <summary> /// Tries the get <see cref="HtmlAttributes"/> stored on a <see cref="MarkdownObject"/>. /// </summary> /// <param name="obj">The markdown object.</param> /// <returns>The attached html attributes or null if not found</returns> public static HtmlAttributes TryGetAttributes(this IMarkdownObject obj) { return(obj.GetData(Key) as HtmlAttributes); }