Skip to content

Stephanevg/PSHTML

Repository files navigation

PSHTML is a cross platform Powershell module to generate HTML markup language within a DSL on Windows and Linux.

Summary

PSHTML logo PSHTML allow people to write a HTML document(s) using powershell-like syntax, which makes building webpages easier, and less cumbersome for 'native' PowerSheller's.

PSHTML offers the flexibility of the PowerShell language, and allows to add logic in powershell directly in the HTML structure. This open the possibility to add loops, conditional statements, switches, functions, classes, calling external modules etc.. all that directly from the same editor.

PSHTML comes with template functionality which allows one to include parts of webpages that are identical throughout the web page Eg: footer, Header,Menu etc..

Using PSHTML, offers code completion and syntax highlighting from the the default powershell language. As PSHTML respects the W3C standards, any HTML errors, will be spotted immediately.

Since version 0.7.0 PSHTML supports the creation of charts.


Detailed introduction

You can find here , an introduction talk about PSHTML by Stéphane van Gulick which teach you in the first step everything you need to know to get started with PSHTML and show concret implementation examples. In the second part of the talk, Stéphane explains how one can extend PSHTML further by coupling it together with Polaris creating a full webserver 100% in powershell.

PsConfEU PSHTML Introduction


Project Status

Appveyor

master dev docs Downloads
Build status Build status Documentation Status PSHTML

AzurePipelines

overall status

master dev
Build Status Build Status

Windows

master dev
Build Status Build Status

Linux

master dev
Build Status Build Status

MacOS

master dev
N/A Build Status

A change log is available here Known issues are tracked here

A few Basic examples of what PSHTML can achieve

Basic page

The following quick example displays a simple page, with a few headers, divs, paragraphs, and header elements

Import-Module PSHTML

html {

    head{

        title "woop title"
        link "css/normalize.css" "stylesheet"
    }

    body{

        h1 "This is h1 Title in header"
        div {
            p {
                "This is simply a paragraph in a div."
            }

            h1 "This is h1"
            h2 "This is h2"
            h3 "This is h3"
            h4 "This is h4"
            h5 "This is h5"
            h6 "This is h6"
            strong "plop";"Woop"
        }

        h1 "My favorites Fruits"

        $Fruits = "Apple","Banana","Orange","Ananas"

        ul {

            foreach($fruit in $Fruits){
                li {
                    $fruit
                }
            }
        }

    }
    footer {
        p{
            "Copyright 2019"
        }
    }

}

A more advanced example

The following example is a tribute to PowerShell GodFather 'Jeffrey Snover' where we generated a BIO of the ShellFather gathering data from Wikipedia and other sources, all that using Powershell.

screen shot of PSHTML results

The example PSHTML / Powershell code is available here

The generated HTML code is available here

Charts

With version 0.7.0 PSHTML introduced the functionality of charting. In v0.8.0 this functionality has been extended and offers now a total of 7 different chart types to communicate your data to your end users, and to make your webpages look amazingly cool!

Charts Overview Charts Overview

Read more about charts and how easy it is to create them using PSHTML here.

Documentation

Check out the Documentation on how to use PSHTML.

Check out references / mentions of PSHTML around the web

The community is actively using PSHTML. Check out what people are saying about it, and how they use PSHTML to implement business solutions. There might be a case answering your specific need?

Have you used PSHTML at work to deliver an awesome project ? Please share with us your experience (Contact me to discuss this.)

See how community members use PSHTML

Find here a few examples where people already used PSHTML in various awesome ways.

Contribute

Are you interested in contributing to the PSHTML project? Read our contribution guide Here.