Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-Demo as markdown does not work well with colored output #115

Open
derekthecool opened this issue Jun 21, 2024 · 0 comments
Open

Export-Demo as markdown does not work well with colored output #115

derekthecool opened this issue Jun 21, 2024 · 0 comments

Comments

@derekthecool
Copy link

This ShowDemo module is fantastic! I like this more than the python lookatme terminal slideshow.
Great work on this!

I'm having trouble with running any command in a demo that would result in colored output showing up badly in the exported markdown demos.

I'm calling the script like this

export-Demo -From ./ -OutputPath ./test.md

My demo script named Dots.demo.ps1 has this content

# 1. Test with numbers first
1..10

# 2. Test with ls with ForEach-Object next exports to markdown nicely (default printing does not have ansi color)
ls | ForEach-Object { $_.Fullname }

# 3. Show PSVersion table
$psversiontable.psVersion.ToString()

# 4. Get ShowDemo module version
(Get-Module -Name ShowDemo | Select-Object -ExpandProperty Version).ToString()

# 5. Exports to mark down with some gross ansi coloring
ls

# 6. Test with some numbers (still bad)
1..10

And results in this markdown output (I'm attaching the file as well in case the web view is not sufficient)
test.md
This test is with my $profile completely blanked out, so no fancy prompts or any modules loaded except showdemo of course.
As soon as any command outputs something that includes color (ls - or Get-ChildItem in this case) it outputs badly and never goes back to a non-bad format.

I'm starting to snoop around the code base for ideas of how to solve this. Do you have any ideas on what might be going on here?

### 1. Test with numbers first


```PowerShell
1..10
1
2
3
4
5
6
7
8
9
10

2. Test with ls with ForEach-Object next exports to markdown nicely (default printing does not have ansi color)

ls | ForEach-Object { $_.Fullname }
C:\Users\dlomax\Scripts\Dots\Demos\Dots.demo.ps1
C:\Users\dlomax\Scripts\Dots\Demos\test.md

3. Show PSVersion table

$psversiontable.psVersion.ToString()
7.4.1

4. Get ShowDemo module version

(Get-Module -Name ShowDemo | Select-Object -ExpandProperty Version).ToString()
0.1.7

5. Exports to mark down with some gross ansi coloring

ls
    Directory: C:\Users\dlomax\Scripts\Dots\Demos

�[32;1mMode   �[0m�[32;1m              LastWriteTime�[0m�[32;1m         Length�[0m�[32;1m Name�[0m

�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m �[32;1m---- �[0m �[32;1m -------------�[0m �[32;1m ------�[0m �[32;1m----�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m -a--- 6/21/2024 2:15 PM 487 �[33;1mDots.demo.ps1�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m -a--- 6/21/2024 2:13 PM 10341 test.md�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m �[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m �[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m### 6. Test with some numbers (still bad)�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0mPowerShell�[0m �[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m1..10�[0m �[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 1�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 2�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 3�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 4�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 5�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 6�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 7�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 8�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 9�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m 10�[0m
�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[32;1m�[0m�[33;1m�[0m �[0m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant