diff --git a/PwshSpectreConsole.Docs/src/content/docs/guides/upgrading-to-2-0.md b/PwshSpectreConsole.Docs/src/content/docs/guides/upgrading-to-2-0.md index 1a64e012..1d1c4bd7 100644 --- a/PwshSpectreConsole.Docs/src/content/docs/guides/upgrading-to-2-0.md +++ b/PwshSpectreConsole.Docs/src/content/docs/guides/upgrading-to-2-0.md @@ -5,7 +5,7 @@ description: Breaking and important changes. ## 💥 Breaking Changes -- **[`Out-SpectreHost`](/reference/rendering/out-spectrehost/) is required if you want to render an item without additional whitespace above and below the item:** +- **[`Out-SpectreHost`](/reference/writing/out-spectrehost/) is required if you want to render an item without additional whitespace above and below the item:** - To enable the new features, the way the console handles the default host output has changed. Version 2.0 uses [powershell formatting](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-7.4) to render Spectre Console objects. When rendered to the terminal PowerShell pads these with a blank line before and after the renderable item. `$data | Format-SpectrePanel | Out-SpectreHost` will force the object to be rendered without padding. @@ -54,7 +54,7 @@ New commandlets to make this PowerShell library compatible with the rest of the - [`Format-SpectreTextPath`](/reference/formatting/format-spectretextpath/) - Render a file/folder path with syntax highlighting. - [`Format-SpectreException`](/reference/formatting/format-spectreexception/) - Render an exception with syntax highlighting. - [`Invoke-SpectreLive`](/reference/live/invoke-spectrelive) - Run a scriptblock and update a renderable item live in real-time. -- [`New-SpectreLayout`](/reference/rendering/new-spectrelayout/) - For rendering items in nested layouts. +- [`New-SpectreLayout`](/reference/formatting/new-spectrelayout/) - For rendering items in nested layouts. ### Updated Commandlets diff --git a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/New-SpectreLayout.mdx b/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/New-SpectreLayout.mdx deleted file mode 100644 index 6c8e207e..00000000 --- a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/New-SpectreLayout.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -sidebar: - badge: - text: New - variant: tip -title: New-SpectreLayout ---- - - - - - - - -import Asciinema from '../../../../components/Asciinema.astro' -import newspectrelayoutExample1 from '../../../../assets/examples/newspectrelayoutExample1.cast?url' - -### Description - -The New-SpectreLayout function creates a new Spectre Layout object with the specified data, columns, or rows. This function is used to create a layout object that can be used to split the console into multiple sections. -You can only have either rows OR columns in a layout and can compose layouts of layouts to create complex layouts. - - - ---- - - -### Examples -> EXAMPLE 1 - -```powershell -$calendar = Write-SpectreCalendar -Date (Get-Date) -PassThru -$files = Get-ChildItem | Format-SpectreTable | Format-SpectreAligned -HorizontalAlignment Right -VerticalAlignment Bottom -$panel1 = $files | Format-SpectrePanel -Header "panel 1 (align bottom right)" -Expand -Color Green -$panel2 = "hello row 2" | Format-SpectrePanel -Header "panel 2" -Expand -Color Blue -$panel3 = $calendar | Format-SpectreAligned | Format-SpectrePanel -Header "panel 3 (align middle center)" -Expand -Color Yellow - -$row1 = New-SpectreLayout -Name "row1" -Data $panel1 -Ratio 1 -$row2 = New-SpectreLayout -Name "row2" -Columns @($panel2, $panel3) -Ratio 2 -$root = New-SpectreLayout -Name "root" -Rows @($row1, $row2) - -$root | Out-SpectreHost -``` - - - ---- - - -### Parameters -#### **Data** - -The data to be displayed in the layout. - - - - - - -|Type |Required|Position|PipelineInput| -|----------|--------|--------|-------------| -|`[Object]`|false |named |false | - - - -#### **Columns** - -The columns to be displayed in the layout. - - - - - - -|Type |Required|Position|PipelineInput| -|---------|--------|--------|-------------| -|`[Array]`|true |named |false | - - - -#### **Rows** - -The rows to be displayed in the layout. - - - - - - -|Type |Required|Position|PipelineInput| -|---------|--------|--------|-------------| -|`[Array]`|true |named |false | - - - -#### **Ratio** - -The ratio of the layout, when composing layouts of layouts you can use a higher ratio in one layout to make it larger than the other layouts. - - - - - - -|Type |Required|Position|PipelineInput| -|---------|--------|--------|-------------| -|`[Int32]`|false |named |false | - - - -#### **Name** - -The name of the layout, this is used when you want to access one of the layouts in a nested layout to update the contents. -e.g. in the example below to update the contents of row1 you would use `$root = $root["row1"].Update(("hello row 1 again" | Format-SpectrePanel))` - - - - - - -|Type |Required|Position|PipelineInput| -|----------|--------|--------|-------------| -|`[String]`|false |named |false | - - - -#### **MinimumSize** - -The minimum size of the layout, this can be used to ensure a layout is at least the minimum width. - - - - - - -|Type |Required|Position|PipelineInput| -|---------|--------|--------|-------------| -|`[Int32]`|false |named |false | - - - - - ---- - - -### Syntax -```powershell -New-SpectreLayout [-Data ] [-Ratio ] [-Name ] [-MinimumSize ] [] -``` -```powershell -New-SpectreLayout -Columns [-Ratio ] [-Name ] [-MinimumSize ] [] -``` -```powershell -New-SpectreLayout -Rows [-Ratio ] [-Name ] [-MinimumSize ] [] -``` diff --git a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/Out-SpectreHost.mdx b/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/Out-SpectreHost.mdx deleted file mode 100644 index a5ce8362..00000000 --- a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/Out-SpectreHost.mdx +++ /dev/null @@ -1,89 +0,0 @@ ---- -sidebar: - badge: - text: New - variant: tip -title: Out-SpectreHost ---- - - - - - - - -import Asciinema from '../../../../components/Asciinema.astro' -import outspectrehostExample1 from '../../../../assets/examples/outspectrehostExample1.cast?url' - -### Description - -Out-SpectreHost writes a spectre renderable object to the console host. -This function is used to output spectre renderables to the console when you want to avoid the additional newlines that the PowerShell formatter adds. - - - ---- - - -### Examples -> EXAMPLE 1 - -```powershell -$table = Get-ChildItem | Select-Object Name, Length, LastWriteTime | Format-SpectreTable -$table | Out-SpectreHost -``` - - - ---- - - -### Parameters -#### **Data** - -The data to write to the console. - - - - - - -|Type |Required|Position|PipelineInput | -|----------|--------|--------|--------------| -|`[Object]`|true |1 |true (ByValue)| - - - -#### **CustomItemFormatter** - -The default host customitem formatter has some restrictions, it needs to be one char less wide than when outputting to the standard console or it will wrap. - - - - - - -|Type |Required|Position|PipelineInput| -|----------|--------|--------|-------------| -|`[Switch]`|false |named |false | - - - - - ---- - - -### Syntax -```powershell -Out-SpectreHost [-Data] [-CustomItemFormatter] [] -``` diff --git a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_New-SpectreLayout.sha256 b/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_New-SpectreLayout.sha256 deleted file mode 100644 index e5e281d8..00000000 --- a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_New-SpectreLayout.sha256 +++ /dev/null @@ -1 +0,0 @@ -9A6E9AE51743F7994D4357BBEFBBDA441DB1C3F29AE19D1C24221BD406522403 \ No newline at end of file diff --git a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_Out-SpectreHost.sha256 b/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_Out-SpectreHost.sha256 deleted file mode 100644 index ae480434..00000000 --- a/PwshSpectreConsole.Docs/src/content/docs/reference/Rendering/_Out-SpectreHost.sha256 +++ /dev/null @@ -1 +0,0 @@ -272C2BD3BD811C22678880F0782ED3CBC71C663515BD7F535D5E59D3AF3451B4 \ No newline at end of file