Created
May 13, 2019 17:16
-
-
Save demofan/18dd5023d5f7650d68640976f91372a0 to your computer and use it in GitHub Desktop.
TagHelper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HtmlTargetElement("bold",Attributes = "bold")] | |
public class BoldTagHelper : TagHelper | |
{ | |
public override void Process(TagHelperContext context, TagHelperOutput output) | |
{ | |
output.Attributes.RemoveAll("bold"); | |
output.PreContent.SetHtmlContent("<strong>"); | |
output.PostContent.SetHtmlContent("</strong>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment