Skip to content

Commit 37a1fb5

Browse files
feat: Adding MarkX build ( Fixes PoshWeb#1, Fixes PoshWeb#10 )
1 parent 26e6e2b commit 37a1fb5

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Push-Location $PSScriptRoot
1313
#region Install Prereqs
1414
if ($env:GITHUB_WORKFLOW) {
1515
$null = sudo npm install -g '@11ty/eleventy'
16+
17+
Install-Module MarkX
1618
}
1719
#endregion Install Prereqs
1820

build.with.powershell.markx.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
param(
2+
[Alias('Input')]
3+
[string]
4+
$InputPath = "$psScriptRoot/TestMarkdown",
5+
6+
[string]
7+
$OutputPath = "$psScriptRoot/PowerShellMarkX"
8+
)
9+
10+
11+
foreach ($fullPath in [IO.Directory]::EnumerateFileSystemEntries($InputPath)) {
12+
$markx = markx ([IO.File]::ReadAllText($fullPath))
13+
14+
$fileName = @($fullPath -split '[\\/]')[-1]
15+
16+
$directoryPath = $OutputPath, ($fileName -replace '\.md$') -join '/'
17+
18+
if (-not [IO.Directory]::Exists($directoryPath)) {
19+
$null = [IO.Directory]::CreateDirectory($directoryPath)
20+
}
21+
22+
$fileOutputPath = $OutputPath, ($fileName -replace '\.md$'), 'index.html' -join '/'
23+
24+
[IO.File]::WriteAllText($fileOutputPath, $markx.html)
25+
}

0 commit comments

Comments
 (0)