Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-HTMLTag

Namespace PSWriteHTML

Creates a new HTML tag with specified attributes and content.

Remarks

The New-HTMLTag function creates a new HTML tag with the specified tag name, attributes, and content. It supports self-closing tags, custom attributes, and new line formatting.

Examples

Authored help example

EXAMPLE 1


New-HTMLTag -Tag "div" -Attributes @{ class = "container" } -Value { "Hello, World!" }
        

Creates a <div> tag with the class attribute set to "container" and the content "Hello, World!".

EXAMPLE 2


New-HTMLTag -Tag "img" -Attributes @{ src = "image.jpg"; alt = "Image" } -SelfClosing
        

Creates an <img> tag with the src and alt attributes set and is self-closing.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

New-HTMLTag [-Attributes <IDictionary>] [-NewLine] [-NoClosing] [-SelfClosing] -Tag <String> [-Value <ScriptBlock>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Attributes IDictionary optionalposition: namedpipeline: False
Specifies additional attributes for the HTML tag.
NewLine SwitchParameter optionalposition: namedpipeline: False
Indicates whether a new line should be added after the HTML tag.
NoClosing SwitchParameter optionalposition: namedpipeline: False
Indicates whether the HTML tag should not have a closing tag.
SelfClosing SwitchParameter optionalposition: namedpipeline: False
Indicates whether the HTML tag is self-closing.
Tag String requiredposition: 1pipeline: False
Specifies the name of the HTML tag to create.
Value ScriptBlock optionalposition: 0pipeline: Falsealiases: Content
Specifies the content of the HTML tag as a script block.