Tag 1.3.1

dotnet add package Tag --version 1.3.1                
NuGet\Install-Package Tag -Version 1.3.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tag" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tag --version 1.3.1                
#r "nuget: Tag, 1.3.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tag as a Cake Addin
#addin nuget:?package=Tag&version=1.3.1

// Install Tag as a Cake Tool
#tool nuget:?package=Tag&version=1.3.1                

T·g

A simple C# generator for HTML/XML

https://www.nuget.org/packages/Tag

Why?

Sometimes you have a project where a lot of code is needed to output a little markup. For those projects, markup templating engines make things more difficult, and a lot of the time you end up doing string concatenation. T·g is a step up from string concatenation.

Usage

See the TagTests.cs file for examples of every feature. Here are some overviews to get you started.

Basic usage

var tag = T.g("div", "class","glass")[
             T.g("a", "href", "#")["Fish"],
             T.g("br/")
          ];

Console.WriteLine(tag.ToString());

Outputs <div class="glass"><a href="#">Fish</a><br/></div>

Writing to a stream

var tag = T.g( . . . );
tag.StreamTo(myWritableStream, Encoding.UTF8);

if StreamTo is called multiple times, it will write another copy of the tag tree.

Templating and injection pattern

var doc = HtmlDoc("Hello World", out var head, out var body);

body.Add(T.g("h1")["Hello, world"]);
body.Add(T.g("p")["This is a simple HTML page example"]);

return doc.ToString();

.
.
.

TagContent HtmlDoc(string title, out TagContent head, out TagContent body)
{
    var html = T.g("html");

    head = T.g("head")[
                    T.g("title")[title],
                    T.g("style").LoadFile("Styles/PageStyle.css")
                ]
            ];
    
    body = T.g("body")[T.g("script").LoadFile("Scripts/PageScript.js")];

    html.Add(head);
    html.Add(body);

    return html;
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.2 is compatible.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wpa81 was computed. 
Windows Store netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Tag:

Package Downloads
Gasconade

A log message management system and exploration UI, in a similar vein to Swagger. Contains an expressive templating system.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 5,227 3/20/2019
1.3.0 1,204 7/9/2018
1.2.0 891 5/24/2018
1.1.0 1,418 4/17/2018
1.0.4 999 4/16/2018
1.0.3 936 4/16/2018
1.0.2 1,088 4/13/2018
1.0.1 947 12/8/2017
1.0.0 1,280 11/14/2017

Adding ReSharper annotations