Replies: 2 comments
-
If you run |
Beta Was this translation helpful? Give feedback.
0 replies
-
function ConvertToNotebook {
param([string] $markdownFileName)
[string] $content = Get-Content -Path $markdownFileName -Encoding utf8 -Raw
$contentNew = $content -replace '(?msi)```PowerShell(.*?)```', ('#!pwsh' + [System.Environment]::NewLine + '$1' + [System.Environment]::NewLine + '#!markdown')
$contentNew = '#!markdown' + [System.Environment]::NewLine + [System.Environment]::NewLine + $contentNew
$contentNew | Out-File ($markdownFileName -replace '\.md$', '.dib') -Encoding utf8 -NoNewline
}
function ConvertFromNotebook {
param([string] $notebookFileName)
[string] $content = Get-Content -Path $notebookFileName -Encoding utf8 -Raw
$contentNew = $content -replace '(?msi)#!pwsh\r\n(.*?)\r\n#!markdown', '```PowerShell$1```'
$contentNew = $contentNew -replace '#!markdown\r\n\r\n', ''
$contentNew | Out-File ($notebookFileName -replace '\.dib$', '.md') -Encoding utf8 -NoNewline
} ✅ Tested on Windows 10 on PS7 Maybe this code could be part of the extension. Maybe a new context menu entry? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Once I am done with all coding and notes to that, I would like to share that, for example with coworkers. But then they would have to have the same set of tools (VS Code with the extension). Or I would like to post it to some Azure DevOps wiki. Then I would need pure markdown. Code samples should be then wrapped in ```'s to make them code block (at least I imagine that it should work like that).
Beta Was this translation helpful? Give feedback.
All reactions