Skip to content

Commit d410370

Browse files
committed
docs
1 parent 4f93329 commit d410370

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

docs/htmltags.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
11
<img src="assets/razor-blade-logo.png" width="100%">
22

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_
47

58
_return to [overview](https://github.com/DNN-Connect/razor-blade)_
69

7-
## Introduction to the HtmlTags API
10+
## Introduction to the Fluent Tag API
811

912
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:
1013

1114
```razor
12-
@using Connect.Razor.Blade.Html;
15+
@using Connect.Razor.Blade;
1316
@{
1417
var box = new Div().Id("wrapper").Class("box");
1518
}
16-
@box.Wrap()
19+
@box.Wrap("some content")
1720
@box.Open
1821
Nice content
1922
@box.Close
2023
```
2124

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)_
3026

31-
## Tag Objects in HtmlTags _(new in 2.0)_
27+
## Tag Objects in _(new in 2.0)_
3228

3329
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
3430
`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.
3632

3733
_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._
3834

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="assets/razor-blade-logo.png" width="100%">
22

3-
# Razor Blade Tag Object _new in 1.3_
3+
# Razor Blade Tag Object _new in 2.0_
44

55
_return to [overview](https://github.com/DNN-Connect/razor-blade)_
66

@@ -16,8 +16,7 @@ To see this in action with many examples, visit the [RazorBlade Tutorials](https
1616

1717
## Quick-Reference: Fluent `Tag` Methods with Chaining
1818

19-
All these methods below change the object, and return the object itself again. This fluent-API allows chaining them together, like `myImg.Id("someId").Class("float-right")`. Remember that you will need to include this namespace:
20-
`@using Connect.Razor.Blade.HtmlTags;`
19+
All these methods below change the object, and return the object itself again. This fluent-API allows chaining them together, like `myImg.Id("someId").Class("float-right")`.
2120

2221
### Modifying Tag Attributes
2322

@@ -65,9 +64,9 @@ will render the close-tag to html. Implements IHtmlString and will not be encode
6564

6665
The following APIs will get you `Tag` objects:
6766

68-
1. `Tags.Tag(...)` in `Connect.Razor.Blade` ([more](tags.md))
69-
2. `new Tag(...)` in `Connect.Razor.Blade.HtmlTags` ([more](htmltags.md))
70-
3. `new ***(...)` in `Connect.Razor.Blade.HtmlTags` ([more](htmltags.md))
67+
1. `Tags.Tag(...)` ([more](tags.md))
68+
2. `new Tag(...)` ([more](tag.md))
69+
3. `new ***(...)` ([more TODO HTML5](htmltags.md))
7170

7271
### How to Render (output) Tag Objects
7372

@@ -85,10 +84,9 @@ All `Tag` Objects will directly output to Html since it implements `IHtmlString`
8584
@myStyle.Close
8685
```
8786

88-
## Advanced `HtmlTags.Tag` API
87+
## Fluent `Tag` API
88+
8989

90-
The `Tag` object lies in the `Connect.Razor.Blade.HtmlTags` namespace, so to start using it, you'll need to add
91-
`using Connect.Razor.Blade.HtmlTags;`.
9290

9391
## `Tag` Constructors
9492

docs/tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The following commands may seem unnecessary, but there are many cases where your
4040
[read more](html.md) -->
4141

4242
2. `Tags.Tag(name, [content])`
43-
generate a [Tag](htmltags.tag.md) object which can be used like these brief examples ([more](htmltags.tag.md)):
43+
generate a [Tag](tag.md) object which can be used like these brief examples ([more](tag.md)):
4444
`@Tags.Tag("div")`
4545
`@Tags.Tag("div", "inner content")`
4646
`@Tags.Tag("div").Id("box").Wrap("inner message")`

0 commit comments

Comments
 (0)