Namespace ToSic.Razor.Blade
This is the main namespace you will be working with. Add it to your page like this:
@using ToSic.Razor.Blade;
After that you can simply use the commands - so here's a super simple cshtml file:
@using ToSic.Razor.Blade;
<div>
@Text.Ellipsis("this text is much too long & will need to be truncated", 25)
</div>
Classes
HtmlPage
Access the surrounding page and read/modify some properties, and add various kinds of headers to the <head> of the current page.
Tag
Helper to quickly generate all HTML5 tags with a Tag.Img() or Tag.Table() syntax.
This is the easiest and safest way to use in in Razor templates because you won't have naming issues etc.
The objects are smart - for example this will automatically uri-encode 😎
Tag.Img().Src("ünsafe.jpg")
Important: Tag can easily be confused with the Tags object.
new in 3.0
Tags
The Tags-API is for manipulating strings which contain html or should contain html
- like stripping away tags, converting
<br>
tags to new-lines and similar.
Important: Tags can easily be confused with the Tag object.
Text
Many simple commands to work with Text / Strings
Interfaces
IScrub
IScrub helps wash/clean html from things you want removed. It can take care of all tags, just specific tags or certain attributes.
Note that it is implemented as an interface, so you must use Dependency Injection to get it.