GithubHelp home page GithubHelp logo

lanicon / twinvision.flow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twinvision/twinvision.flow

0.0 1.0 0.0 2.28 MB

Fluent HTML builder written in c#

License: MIT License

C# 93.45% Visual Basic .NET 6.55%

twinvision.flow's Introduction

Twinvision.Flow Build Status

An HTML builder library to create html using a fluent C# builder pattern with no external package dependencies. See below for some code examples.

Hello world example

Code

var builder = new HTMLBuilder();
builder.Document().Body(content: "Hello world!");
System.Diagnostics.Debug.WriteLine(builder.ToString());

Output

<!DOCTYPE html>
<html>
    <body>Hello world!</body>
</html>

Create div with comments

Code

var builder = new HTMLBuilder();
builder.Document("en").Body()
       .Comment("A comment for" + Environment.NewLine + "a div element")
       .Div(content: "HTML comments test");
System.Diagnostics.Debug.WriteLine(builder.ToString());

Output

<!DOCTYPE html>
<html lang="en">
    <body>
        <!--
            A comment for
            a div element
        -->
        <div>HTML comments test</div>
    </body>
</html>

Create component block

Code

var builder = new HTMLBuilder();
builder.Document().Body()
       .H(1, "Component example")
       .BeginComponent("My Component")
            .Div("Main component element")
                .Child()
                    .AddElement("span", "Extra component content")
                .Parent()
       .EndComponent();
System.Diagnostics.Debug.WriteLine(builder.ToString());

Result

<!DOCTYPE html>
<html>
    <body>
        <h1>Component example</h1>
        <!-- Begin My Component -->
        <div class="Main component element">
            <span>Extra component content</span>
        </div>
        <!-- End My Component -->
    </body>
</html>

twinvision.flow's People

Contributors

wouterleenders avatar marcodonkers avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.