|
1 | 1 | <img src="assets/razor-blade-logo.png" width="100%"> |
2 | 2 |
|
3 | | -# Razor Blade HtmlTags API _v2.0_ |
| 3 | + |
| 4 | +TODO: CHANGE TO HTML5 ETC. AS A LOT IS DIFFERENT NOW |
| 5 | + |
| 6 | +# Razor Blade Fluent Tag API _v2.0_ |
4 | 7 |
|
5 | 8 | _return to [overview](https://github.com/DNN-Connect/razor-blade)_ |
6 | 9 |
|
7 | | -## Introduction to the HtmlTags API |
| 10 | +## Introduction to the Fluent Tag API |
8 | 11 |
|
9 | 12 | Building valid HTML in code is tricky, especially when you have attributes containing dangerous characters like `'` and `"`, which is common both in JSON attributes as well as when you need attributes based on content added by editors. So we created an extensive API to generate safe html and encode things optimally - this is what this is for. Here's a basic example: |
10 | 13 |
|
11 | 14 | ```razor |
12 | | -@using Connect.Razor.Blade.Html; |
| 15 | +@using Connect.Razor.Blade; |
13 | 16 | @{ |
14 | 17 | var box = new Div().Id("wrapper").Class("box"); |
15 | 18 | } |
16 | | -@box.Wrap() |
| 19 | +@box.Wrap("some content") |
17 | 20 | @box.Open |
18 | 21 | Nice content |
19 | 22 | @box.Close |
20 | 23 | ``` |
21 | 24 |
|
22 | | -_Note: If you're looking for the API to manipulate html strings, like for stripping away all tags or encoding/decoding Html, check out the [Tags API](tags.md)_ |
23 | | - |
24 | | -## Using the HtmlTags API |
25 | | - |
26 | | -HtmlTags is a namespace, so to start using it, you'll need to add |
27 | | -`using Connect.Razor.Blade.HtmlTags;` |
28 | | -into your razor file |
29 | | - |
| 25 | +_Note: If you're looking for the API to manipulate html **strings**, like for stripping away all tags or encoding/decoding Html, check out the [Tags API](tags.md)_ |
30 | 26 |
|
31 | | -## Tag Objects in HtmlTags _(new in 2.0)_ |
| 27 | +## Tag Objects in _(new in 2.0)_ |
32 | 28 |
|
33 | 29 | Below each tag you'll see a list of methods that can be called to set a value common to that tag. These are for chaining, so you can do things like |
34 | 30 | `var img = new Img().Src("...").Class("...").Id("...");` |
35 | | -The methods with a note _append_ would append a value if called multiple times, whereas _replace_ would replace the value. See the [Tag](htmltags.tag.md) documentations on this. All these objects also have the common methods like `Id()`, `Class()`, `Title()`, `Data()`, `Wrap()` etc. so do check the `Tag` documentations. |
| 31 | +The methods with a note _append_ would append a value if called multiple times, whereas _replace_ would replace the value. See the [Tag](tag.md) documentations on this. All these objects also have the common methods like `Id()`, `Class()`, `Title()`, `Data()`, `Wrap()` etc. so do check the `Tag` documentations. |
36 | 32 |
|
37 | 33 | _Note that when you see `[content]`, this means you can pass in optional content into the tag. This can be a string, or another tag._ |
38 | 34 |
|
|
0 commit comments