Skip to content

Commit b03908b

Browse files
Merge pull request #43 from StartAutomating/MarkX-0.1.2
MarkX 0.1.2
2 parents 02fadca + f2211ed commit b03908b

4 files changed

Lines changed: 36 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## MarkX 0.1.2:
2+
3+
Minor performance improvements:
4+
5+
* Directly using Markdig (#38)
6+
* Preferring `[IO.File]::Exists` (#42)
7+
8+
---
9+
110
## MarkX 0.1.1:
211

312
* MarkX Help (#26)

MarkX.psd1

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'MarkX.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.1.1'
15+
ModuleVersion = '0.1.2'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -63,18 +63,12 @@ PrivateData = @{
6363

6464
# ReleaseNotes of this module
6565
ReleaseNotes = @'
66-
## MarkX 0.1.1:
67-
68-
* MarkX Help (#26)
69-
* MarkX now accepts commands / help (#27)
70-
* MarkX.Headings gets heading elements (#29)
71-
* MarkX.Lexicon gets lexicons in Markdown (#25)
72-
* MarkX.YamlHeader support (#32, #33)
73-
* Allowing piped markdown file input (#34)
74-
* MarkX.Code gets code within markdown (#30)
75-
* MarkX.CodeBlock gets code blocks within markdown (#31)
76-
* MarkX.ToString can now stringify any property (#35)
77-
* MarkX formatting (#36)
66+
## MarkX 0.1.2:
67+
68+
Minor performance improvements:
69+
70+
* Directly using Markdig (#38)
71+
* Preferring `[IO.File]::Exists` (#42)
7872
7973
---
8074

MarkX.types.ps1xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<Name>Sync</Name>
3636
<Script>
3737
$currentRows = @()
38+
3839
$allMarkdown = @(:nextInput foreach ($md in $this.Input) {
3940
if ($md -isnot [string]) {
4041
# If the markdown was a file
@@ -141,7 +142,10 @@ $allMarkdown = @(:nextInput foreach ($md in $this.Input) {
141142
}
142143

143144
if ($md -match '(?&gt;\.md|markdown)$' -and
144-
(Test-Path $md -ErrorAction Ignore)
145+
(
146+
[IO.File]::Exists("$md") -or
147+
(Test-Path $md -ErrorAction Ignore)
148+
)
145149
) {
146150
$md = Get-Content -Raw $md
147151
}
@@ -167,7 +171,7 @@ $allMarkdown = @(foreach ($md in $allMarkdown) {
167171
if ($md -match '^---') {
168172
$null, $yamlheader, $restOfMakdown = $md -split '---', 3
169173
if ($yamlheader) {
170-
$yamlHeaders+= $yamlheader
174+
$yamlHeaders+= $yamlheader
171175
}
172176
$restOfMakdown
173177
} else {
@@ -191,11 +195,12 @@ $Markdown = $this.'#Markdown'
191195

192196
if (-not $Markdown) { return }
193197

198+
$mdPipelineBuilder = [Markdig.MarkdownPipelineBuilder]::new()
199+
$mdPipeline = [Markdig.MarkdownExtensions]::UsePipeTables($mdPipelineBuilder).Build()
200+
194201
$this |
195202
Add-Member NoteProperty '#HTML' (
196-
$Markdown |
197-
ConvertFrom-Markdown |
198-
Select-Object -ExpandProperty Html
203+
[Markdig.Markdown]::ToHtml($markdown, $mdPipeline)
199204
) -Force
200205

201206
$this |

Types/MarkX/Sync.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$currentRows = @()
2+
23
$allMarkdown = @(:nextInput foreach ($md in $this.Input) {
34
if ($md -isnot [string]) {
45
# If the markdown was a file
@@ -105,7 +106,10 @@ $allMarkdown = @(:nextInput foreach ($md in $this.Input) {
105106
}
106107

107108
if ($md -match '(?>\.md|markdown)$' -and
108-
(Test-Path $md -ErrorAction Ignore)
109+
(
110+
[IO.File]::Exists("$md") -or
111+
(Test-Path $md -ErrorAction Ignore)
112+
)
109113
) {
110114
$md = Get-Content -Raw $md
111115
}
@@ -131,7 +135,7 @@ $allMarkdown = @(foreach ($md in $allMarkdown) {
131135
if ($md -match '^---') {
132136
$null, $yamlheader, $restOfMakdown = $md -split '---', 3
133137
if ($yamlheader) {
134-
$yamlHeaders+= $yamlheader
138+
$yamlHeaders+= $yamlheader
135139
}
136140
$restOfMakdown
137141
} else {
@@ -155,11 +159,12 @@ $Markdown = $this.'#Markdown'
155159

156160
if (-not $Markdown) { return }
157161

162+
$mdPipelineBuilder = [Markdig.MarkdownPipelineBuilder]::new()
163+
$mdPipeline = [Markdig.MarkdownExtensions]::UsePipeTables($mdPipelineBuilder).Build()
164+
158165
$this |
159166
Add-Member NoteProperty '#HTML' (
160-
$Markdown |
161-
ConvertFrom-Markdown |
162-
Select-Object -ExpandProperty Html
167+
[Markdig.Markdown]::ToHtml($markdown, $mdPipeline)
163168
) -Force
164169

165170
$this |

0 commit comments

Comments
 (0)