Merge pull request #203 from matteofabbri/master

added class attribute to media link extension
This commit is contained in:
Alexandre Mutel
2018-02-01 10:06:31 +01:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@@ -154,8 +154,16 @@ namespace Markdig.Extensions.MediaLinks
var htmlAttributes = GetHtmlAttributes(linkInline);
renderer.Write($"<iframe src=\"{foundProvider.Result}\"");
htmlAttributes.AddPropertyIfNotExist("width", Options.Width);
htmlAttributes.AddPropertyIfNotExist("height", Options.Height);
if(!string.IsNullOrEmpty(Options.Width))
htmlAttributes.AddPropertyIfNotExist("width", Options.Width);
if (!string.IsNullOrEmpty(Options.Height))
htmlAttributes.AddPropertyIfNotExist("height", Options.Height);
if (!string.IsNullOrEmpty(Options.Class))
htmlAttributes.AddPropertyIfNotExist("class", Options.Class);
htmlAttributes.AddPropertyIfNotExist("frameborder", "0");
if (foundProvider.AllowFullScreen)
{

View File

@@ -16,6 +16,7 @@ namespace Markdig.Extensions.MediaLinks
{
Width = "500";
Height = "281";
Class = "";
ExtensionToMimeType = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{".3gp", "video/3gpp"},
@@ -87,6 +88,8 @@ namespace Markdig.Extensions.MediaLinks
public string Height { get; set; }
public string Class { get; set; }
public Dictionary<string, string> ExtensionToMimeType { get; }
}
}