API Reference
New-HTMLCodeBlock
Creates a new HTML code block with customizable settings for syntax highlighting.
Remarks
This function creates a new HTML code block with customizable settings for syntax highlighting. It allows you to specify the code language, theme, group, title, line numbers visibility, highlighted lines, and line numbering offset.
Examples
EXAMPLE 1
New-HTMLCodeBlock -Code "function greet() { return 'Hello, World!'; }" -Style 'javascript' -Theme 'monokai' -Group 'Functions' -Title 'Greeting Function' -Highlight 2,4-6 -ShowLineNumbers $true -LineOffset 1
Creates a new HTML code block displaying a JavaScript function with a custom theme, belonging to the 'Functions' group, titled 'Greeting Function', highlighting lines 2, 4 to 6, showing line numbers, and starting line numbering from 1.
EXAMPLE 2
New-HTMLCodeBlock -Code "for ($i = 0; $i -lt 5; $i++) { Write-Host $i }" -Style 'powershell' -Group 'Loops' -Title 'For Loop Example' -ShowLineNumbers $false
Creates a new HTML code block displaying a PowerShell for loop without line numbers, belonging to the 'Loops' group, titled 'For Loop Example'.
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-HTMLCodeBlock -Code <String> [-Group <String>] [-Highlight <String[]>] [-LineOffset <String>] [-ShowLineNumbers <Nullable`1>] [-Style <assembly>] [-Theme <enlighter>] [-Title <String>] [<CommonParameters>]
#
All Parameter SetsParameters
- Code String
- Specifies the code content to be displayed in the code block.
- Group String
- Specifies the group to which the code block belongs.
- Highlight String[]
- Specifies specific lines to highlight in the code block.
- LineOffset String
- Specifies the starting line number offset for line numbering.
- ShowLineNumbers Nullable`1
- Indicates whether line numbers should be displayed in the code block.
- Style String
- Specifies the language style for syntax highlighting. Default is 'powershell'.
- Possible values:
assembly,asm,avrassembly,avrasm,c,cpp,c++,csharp,css,cython,cordpro,diff,docker,dockerfile,generic,standard,groovy,go,golang,html,ini,conf,java,js,javascript,jquery,mootools,ext.js,json,kotlin,less,lua,gfm,md,markdown,octave,matlab,nsis,php,powershell,prolog,py,python,raw,ruby,rust,scss,sass,shell,bash,sql,squirrel,swift,typescript,vhdl,visualbasic,vb,xml,yaml - Theme String
- Specifies the theme for the code block. Available themes include 'enlighter', 'beyond', 'classic', and more.
- Possible values:
enlighter,beyond,classic,godzilla,atomic,droide,minimal,eclipse,mowtwo,rowhammer,bootstrap4,dracula,monokai - Title String
- Specifies the title of the code block.