Skip to content

Commit 6e5726d

Browse files
authored
Merge pull request #7 from Earlybyte/master
Added del, em, strong, sub and sup tags and its default styles
2 parents 2b2316f + 1cfe794 commit 6e5726d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

HTMLToQPDF/Components/HTMLComponent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@ internal class HTMLComponent : IComponent
2525
{ "h5", TextStyle.Default.FontSize(16).Bold() },
2626
{ "h6", TextStyle.Default.FontSize(12).Bold() },
2727
{ "b", TextStyle.Default.Bold() },
28+
{ "strong", TextStyle.Default.Bold() },
2829
{ "i", TextStyle.Default.Italic() },
30+
{ "em", TextStyle.Default.Italic() },
2931
{ "small", TextStyle.Default.Light() },
3032
{ "strike", TextStyle.Default.Strikethrough() },
33+
{ "del", TextStyle.Default.Strikethrough() },
3134
{ "s", TextStyle.Default.Strikethrough() },
3235
{ "u", TextStyle.Default.Underline() },
3336
{ "a", TextStyle.Default.Underline() },
37+
{ "sup", TextStyle.Default.Superscript() },
38+
{ "sub", TextStyle.Default.Subscript() },
39+
3440
};
3541

3642
public Dictionary<string, Func<IContainer, IContainer>> ContainerStyles { get; } = new Dictionary<string, Func<IContainer, IContainer>>()

HTMLToQPDF/StyleSettings.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ internal static class HTMLMapSettings
1212
"a",
1313
"b",
1414
"br",
15+
"del",
16+
"em",
1517
"i",
1618
"s",
1719
"small",
1820
"space",
1921
"strike",
22+
"strong",
23+
"sub",
24+
"sup",
2025
"tbody",
2126
"td",
2227
"th",
@@ -52,7 +57,7 @@ public static IComponent GetComponent(this HtmlNode node, HTMLComponentsArgs arg
5257
{
5358
return node.Name.ToLower() switch
5459
{
55-
"#text" or "h1" or "h2" or "h3" or "h4" or "h5" or "h6" or "b" or "s" or "strike" or "i" or "small" or "u"
60+
"#text" or "h1" or "h2" or "h3" or "h4" or "h5" or "h6" or "b" or "s" or "strike" or "i" or "small" or "u" or "del" or "em" or "strong" or "sub" or "sup"
5661
=> new ParagraphComponent(new List<HtmlNode>() { node }, args),
5762
"br" => new BrComponent(node, args),
5863
"a" => new AComponent(node, args),

0 commit comments

Comments
 (0)