New NotionCodeBlock - fasteiner/Notion GitHub Wiki

New-NotionCodeBlock

SYNOPSIS

Creates a new Notion code block object.

SYNTAX

New-NotionCodeBlock [-Text <Object>] [-Caption <Object>] [-Language <Object>]
 [<CommonParameters>]

DESCRIPTION

This function creates a new instance of the notion_code_block class. You can create an empty code block, provide code text and language, or provide code text, caption, and language.

EXAMPLES

EXAMPLE 1

New-NotionCodeBlock -Text '$a = 1' -Language 'powershell'

Creates a code block with the specified text and language.

EXAMPLE 2

New-NotionCodeBlock -Text '$a = 1' -Caption 'Example' -Language 'powershell'

Creates a code block with the specified text, caption, and language.

EXAMPLE 3

New-NotionCodeBlock

Creates an empty code block.

PARAMETERS

-Caption

The caption (rich_text[] or object) to be displayed above the code block.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Language

The programming language for syntax highlighting in the code block.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Text

The code text to be included in the code block.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[notion_code_block]

NOTES

https://developers.notion.com/reference/block#code

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️