From 88a3abcb134aa0eadc06ce44237f51974f5a9dff Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 14:00:34 -0800 Subject: [PATCH 1/9] feat: MarkX.DataSet late binding ( Fixes #44 ) --- Types/MarkX/Sync.ps1 | 89 +---------------------------------- Types/MarkX/get_DataSet.ps1 | 93 ++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 89 deletions(-) diff --git a/Types/MarkX/Sync.ps1 b/Types/MarkX/Sync.ps1 index fad0730..f1d1fe9 100644 --- a/Types/MarkX/Sync.ps1 +++ b/Types/MarkX/Sync.ps1 @@ -174,91 +174,4 @@ $this | if (-not $this.'#XML') { return } -$tables = $this.'#XML' | Select-Xml //table -filter innerText { - $in = $_ - if ($in -is [string]) { "$in" } - elseif ($in.innerText) { "$($in.innerText)" } - elseif ($in.'#text') { "$($in.'#text')" } -} - -function bestType { - $allIn = @($input) + @(if ($args) { $args}) - switch ($true) { - { $allIn -as [float[]] } { - [float]; break - } - { $allIn -as [double[]] } { - [double]; break - } - { $allIn -as [long[]] } { - [long]; break - } - { $allIn -as [ulong[]] } { - [uint32]; break - } - { $allIn -as [decimal[]] } { - [decimal]; break - } - { $allIn -as [timespan[]] } { - [timespan]; break - } - { $allIn -as [DateTime[]] } { - [DateTime]; break - } - default { - [string] - } - } -} - -$markdownData = [Data.DataSet]::new('MarkX') -$tableNumber = 0 -foreach ($table in $tables) { - $tableNumber++ - $markdownDataTable = $markdownData.Tables.Add("MarkdownTable$tableNumber") - - [string[]]$PropertyNames = @( $table.Node.thead.tr.th | innerText ) - - # We want to upcast our datatable as much as possible - # so we need to collect the rows first - $TableDictionary = [Ordered]@{} - $propertyIndex = 0 - foreach ($property in $propertyNames) { - $TableDictionary[$property] = @( - foreach ($row in $table.Node.tbody.tr) { - @($row.td)[$propertyIndex] | innerText - } - ) - $propertyIndex++ - } - - # Now that we have all of the data collected, - $markdownDataTable.Columns.AddRange(@( - foreach ($property in $propertyNames) { - $propertyIndex = 0 - $bestType = $TableDictionary[$property] | bestType - [Data.DataColumn]::new($property, $bestType, '', 'Attribute') - } - [Data.DataColumn]::new('tr', [xml.xmlelement], '', 'Hidden') - )) - - foreach ($row in $table.Node.tbody.tr) { - $propertyValues = @( - $row.td | innerText - $row - ) - $null = $markdownDataTable.Rows.Add($propertyValues) - } - - $previous = $table.Node.PreviousSibling - if ($previous.LocalName -eq 'blockquote') { - $markdownDataTable.ExtendedProperties.Add("description", $previous.InnerText) - $previous = $previous.PreviousSibling - } - if ($previous.LocalName -match 'h[1-6]') { - $markdownDataTable.TableName = $previous.InnerText - } -} - -$this | Add-Member NoteProperty '#DataSet' $markdownData -Force +$this.psobject.Properties.Remove('#DataSet') diff --git a/Types/MarkX/get_DataSet.ps1 b/Types/MarkX/get_DataSet.ps1 index ef8b5e5..d81f29b 100644 --- a/Types/MarkX/get_DataSet.ps1 +++ b/Types/MarkX/get_DataSet.ps1 @@ -1 +1,92 @@ -return $this.'#DataSet' \ No newline at end of file +if ($this.'#DataSet') {return $this.'#DataSet' } + +$tables = $this.'#XML' | Select-Xml //table +filter innerText { + $in = $_ + if ($in -is [string]) { "$in" } + elseif ($in.innerText) { "$($in.innerText)" } + elseif ($in.'#text') { "$($in.'#text')" } +} + +function bestType { + $allIn = @($input) + @(if ($args) { $args}) + switch ($true) { + { $allIn -as [float[]] } { + [float]; break + } + { $allIn -as [double[]] } { + [double]; break + } + { $allIn -as [long[]] } { + [long]; break + } + { $allIn -as [ulong[]] } { + [uint32]; break + } + { $allIn -as [decimal[]] } { + [decimal]; break + } + { $allIn -as [timespan[]] } { + [timespan]; break + } + { $allIn -as [DateTime[]] } { + [DateTime]; break + } + default { + [string] + } + } +} + +$markdownData = [Data.DataSet]::new('MarkX') +$tableNumber = 0 +foreach ($table in $tables) { + $tableNumber++ + $markdownDataTable = $markdownData.Tables.Add("MarkdownTable$tableNumber") + + [string[]]$PropertyNames = @( $table.Node.thead.tr.th | innerText ) + + # We want to upcast our datatable as much as possible + # so we need to collect the rows first + $TableDictionary = [Ordered]@{} + $propertyIndex = 0 + foreach ($property in $propertyNames) { + $TableDictionary[$property] = @( + foreach ($row in $table.Node.tbody.tr) { + @($row.td)[$propertyIndex] | innerText + } + ) + $propertyIndex++ + } + + # Now that we have all of the data collected, + $markdownDataTable.Columns.AddRange(@( + foreach ($property in $propertyNames) { + $propertyIndex = 0 + $bestType = $TableDictionary[$property] | bestType + [Data.DataColumn]::new($property, $bestType, '', 'Attribute') + } + [Data.DataColumn]::new('tr', [xml.xmlelement], '', 'Hidden') + )) + + foreach ($row in $table.Node.tbody.tr) { + $propertyValues = @( + $row.td | innerText + $row + ) + $null = $markdownDataTable.Rows.Add($propertyValues) + } + + $previous = $table.Node.PreviousSibling + if ($previous.LocalName -eq 'blockquote') { + $markdownDataTable.ExtendedProperties.Add("description", $previous.InnerText) + $previous = $previous.PreviousSibling + } + if ($previous.LocalName -match 'h[1-6]') { + $markdownDataTable.TableName = $previous.InnerText + } +} + +$this | Add-Member NoteProperty '#DataSet' $markdownData -Force + +return $this.'#DataSet' From 8b9dba9b11c0f94802fb141cf4a18a4170911335 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 22:01:50 +0000 Subject: [PATCH 2/9] feat: MarkX.DataSet late binding ( Fixes #44 ) --- MarkX.types.ps1xml | 183 +++++++++++++++++++++++---------------------- 1 file changed, 94 insertions(+), 89 deletions(-) diff --git a/MarkX.types.ps1xml b/MarkX.types.ps1xml index 0a99c26..cb3cc0a 100644 --- a/MarkX.types.ps1xml +++ b/MarkX.types.ps1xml @@ -210,94 +210,7 @@ $this | if (-not $this.'#XML') { return } -$tables = $this.'#XML' | Select-Xml //table -filter innerText { - $in = $_ - if ($in -is [string]) { "$in" } - elseif ($in.innerText) { "$($in.innerText)" } - elseif ($in.'#text') { "$($in.'#text')" } -} - -function bestType { - $allIn = @($input) + @(if ($args) { $args}) - switch ($true) { - { $allIn -as [float[]] } { - [float]; break - } - { $allIn -as [double[]] } { - [double]; break - } - { $allIn -as [long[]] } { - [long]; break - } - { $allIn -as [ulong[]] } { - [uint32]; break - } - { $allIn -as [decimal[]] } { - [decimal]; break - } - { $allIn -as [timespan[]] } { - [timespan]; break - } - { $allIn -as [DateTime[]] } { - [DateTime]; break - } - default { - [string] - } - } -} - -$markdownData = [Data.DataSet]::new('MarkX') -$tableNumber = 0 -foreach ($table in $tables) { - $tableNumber++ - $markdownDataTable = $markdownData.Tables.Add("MarkdownTable$tableNumber") - - [string[]]$PropertyNames = @( $table.Node.thead.tr.th | innerText ) - - # We want to upcast our datatable as much as possible - # so we need to collect the rows first - $TableDictionary = [Ordered]@{} - $propertyIndex = 0 - foreach ($property in $propertyNames) { - $TableDictionary[$property] = @( - foreach ($row in $table.Node.tbody.tr) { - @($row.td)[$propertyIndex] | innerText - } - ) - $propertyIndex++ - } - - # Now that we have all of the data collected, - $markdownDataTable.Columns.AddRange(@( - foreach ($property in $propertyNames) { - $propertyIndex = 0 - $bestType = $TableDictionary[$property] | bestType - [Data.DataColumn]::new($property, $bestType, '', 'Attribute') - } - [Data.DataColumn]::new('tr', [xml.xmlelement], '', 'Hidden') - )) - - foreach ($row in $table.Node.tbody.tr) { - $propertyValues = @( - $row.td | innerText - $row - ) - $null = $markdownDataTable.Rows.Add($propertyValues) - } - - $previous = $table.Node.PreviousSibling - if ($previous.LocalName -eq 'blockquote') { - $markdownDataTable.ExtendedProperties.Add("description", $previous.InnerText) - $previous = $previous.PreviousSibling - } - if ($previous.LocalName -match 'h[1-6]') { - $markdownDataTable.TableName = $previous.InnerText - } -} - -$this | Add-Member NoteProperty '#DataSet' $markdownData -Force +$this.psobject.Properties.Remove('#DataSet') @@ -474,7 +387,99 @@ return $codeByLanguage DataSet - return $this.'#DataSet' + if ($this.'#DataSet') {return $this.'#DataSet' } + +$tables = $this.'#XML' | Select-Xml //table +filter innerText { + $in = $_ + if ($in -is [string]) { "$in" } + elseif ($in.innerText) { "$($in.innerText)" } + elseif ($in.'#text') { "$($in.'#text')" } +} + +function bestType { + $allIn = @($input) + @(if ($args) { $args}) + switch ($true) { + { $allIn -as [float[]] } { + [float]; break + } + { $allIn -as [double[]] } { + [double]; break + } + { $allIn -as [long[]] } { + [long]; break + } + { $allIn -as [ulong[]] } { + [uint32]; break + } + { $allIn -as [decimal[]] } { + [decimal]; break + } + { $allIn -as [timespan[]] } { + [timespan]; break + } + { $allIn -as [DateTime[]] } { + [DateTime]; break + } + default { + [string] + } + } +} + +$markdownData = [Data.DataSet]::new('MarkX') +$tableNumber = 0 +foreach ($table in $tables) { + $tableNumber++ + $markdownDataTable = $markdownData.Tables.Add("MarkdownTable$tableNumber") + + [string[]]$PropertyNames = @( $table.Node.thead.tr.th | innerText ) + + # We want to upcast our datatable as much as possible + # so we need to collect the rows first + $TableDictionary = [Ordered]@{} + $propertyIndex = 0 + foreach ($property in $propertyNames) { + $TableDictionary[$property] = @( + foreach ($row in $table.Node.tbody.tr) { + @($row.td)[$propertyIndex] | innerText + } + ) + $propertyIndex++ + } + + # Now that we have all of the data collected, + $markdownDataTable.Columns.AddRange(@( + foreach ($property in $propertyNames) { + $propertyIndex = 0 + $bestType = $TableDictionary[$property] | bestType + [Data.DataColumn]::new($property, $bestType, '', 'Attribute') + } + [Data.DataColumn]::new('tr', [xml.xmlelement], '', 'Hidden') + )) + + foreach ($row in $table.Node.tbody.tr) { + $propertyValues = @( + $row.td | innerText + $row + ) + $null = $markdownDataTable.Rows.Add($propertyValues) + } + + $previous = $table.Node.PreviousSibling + if ($previous.LocalName -eq 'blockquote') { + $markdownDataTable.ExtendedProperties.Add("description", $previous.InnerText) + $previous = $previous.PreviousSibling + } + if ($previous.LocalName -match 'h[1-6]') { + $markdownDataTable.TableName = $previous.InnerText + } +} + +$this | Add-Member NoteProperty '#DataSet' $markdownData -Force + +return $this.'#DataSet' + From 6aefcb09aee4ad9b208b405baf26648b332527b4 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 15:29:18 -0800 Subject: [PATCH 3/9] feat: MarkX.LiquidPattern ( Fixes #46 ) --- Types/MarkX/get_LiquidPattern.ps1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Types/MarkX/get_LiquidPattern.ps1 diff --git a/Types/MarkX/get_LiquidPattern.ps1 b/Types/MarkX/get_LiquidPattern.ps1 new file mode 100644 index 0000000..b37c73f --- /dev/null +++ b/Types/MarkX/get_LiquidPattern.ps1 @@ -0,0 +1,28 @@ +<# +.SYNOPSIS + Get the Liquid Pattern +.DESCRIPTION + Gets the regular expression pattern used to match Liquid tags. +#> +param() +$liquidPattern = @( + '(?>' + '\{\%\s{0,}' + '(?[^\%]+)' + '\s{0,}\%}' + + '|' + + '(?\{{3})' + '(?[^\}]+)' + '\}{3}' + + '|' + + '\{{2}' + '(?[^\}]+)' + '\}{2}' + ')' +) -join '' + +return [Regex]::new($liquidPattern) From 1ec1870a3c9b92301111983884fb71bd4e5d41fb Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 23:29:38 +0000 Subject: [PATCH 4/9] feat: MarkX.LiquidPattern ( Fixes #46 ) --- MarkX.types.ps1xml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/MarkX.types.ps1xml b/MarkX.types.ps1xml index cb3cc0a..6e07b51 100644 --- a/MarkX.types.ps1xml +++ b/MarkX.types.ps1xml @@ -658,6 +658,40 @@ $markdownData = $this.DataSet } + + LiquidPattern + + <# +.SYNOPSIS + Get the Liquid Pattern +.DESCRIPTION + Gets the regular expression pattern used to match Liquid tags. +#> +param() +$liquidPattern = @( + '(?>' + '\{\%\s{0,}' + '(?<tag>[^\%]+)' + '\s{0,}\%}' + + '|' + + '(?<noescape>\{{3})' + '(?<expression>[^\}]+)' + '\}{3}' + + '|' + + '\{{2}' + '(?<expression>[^\}]+)' + '\}{2}' + ')' +) -join '' + +return [Regex]::new($liquidPattern) + + + Markdown From 71ed4ad14b810300b72b05ebc76a8d4a33e7daa6 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 15:30:54 -0800 Subject: [PATCH 5/9] feat: MarkX.Liquid ( Fixes #45 ) --- Types/MarkX/get_Liquid.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Types/MarkX/get_Liquid.ps1 diff --git a/Types/MarkX/get_Liquid.ps1 b/Types/MarkX/get_Liquid.ps1 new file mode 100644 index 0000000..fef0767 --- /dev/null +++ b/Types/MarkX/get_Liquid.ps1 @@ -0,0 +1,9 @@ +<# +.SYNOPSIS + Get Liquid +.DESCRIPTION + Get Liquid within the Markdown +#> +if ($this.LiquidPattern -is [regex]) { + return $this.LiquidPattern.Matches("$($this.Markdown)") +} From 9f505d300bacd0dfab4e0c7da272ee19e179ff49 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Tue, 27 Jan 2026 23:31:09 +0000 Subject: [PATCH 6/9] feat: MarkX.Liquid ( Fixes #45 ) --- MarkX.types.ps1xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/MarkX.types.ps1xml b/MarkX.types.ps1xml index 6e07b51..5204c48 100644 --- a/MarkX.types.ps1xml +++ b/MarkX.types.ps1xml @@ -658,6 +658,21 @@ $markdownData = $this.DataSet } + + Liquid + + <# +.SYNOPSIS + Get Liquid +.DESCRIPTION + Get Liquid within the Markdown +#> +if ($this.LiquidPattern -is [regex]) { + return $this.LiquidPattern.Matches("$($this.Markdown)") +} + + + LiquidPattern From d41dd901d3c3e016028be15f48bf725e968263d5 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Thu, 29 Jan 2026 13:40:38 -0800 Subject: [PATCH 7/9] docs: MarkX.Table help --- Types/MarkX/get_Table.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Types/MarkX/get_Table.ps1 b/Types/MarkX/get_Table.ps1 index 67d86b1..31bb18a 100644 --- a/Types/MarkX/get_Table.ps1 +++ b/Types/MarkX/get_Table.ps1 @@ -1 +1,9 @@ -$this.XML | Select-Xml -XPath '//table' | Select-Object -ExpandProperty Node \ No newline at end of file +<# +.SYNOPSIS + Gets any tables +.DESCRIPTION + Gets any tables present in the markdown +#> +$this.XML | + Select-Xml -XPath '//table' | + Select-Object -ExpandProperty Node \ No newline at end of file From a332eb2b576fba422edc2dfb5e097de1f26d478b Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Thu, 29 Jan 2026 21:40:54 +0000 Subject: [PATCH 8/9] docs: MarkX.Table help --- MarkX.types.ps1xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MarkX.types.ps1xml b/MarkX.types.ps1xml index 5204c48..91a647a 100644 --- a/MarkX.types.ps1xml +++ b/MarkX.types.ps1xml @@ -724,7 +724,15 @@ $this.Input = $Markdown Table - $this.XML | Select-Xml -XPath '//table' | Select-Object -ExpandProperty Node + <# +.SYNOPSIS + Gets any tables +.DESCRIPTION + Gets any tables present in the markdown +#> +$this.XML | + Select-Xml -XPath '//table' | + Select-Object -ExpandProperty Node From f6a4e323ac216dad76a7acd6ee6d49ed4b7a675f Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Thu, 29 Jan 2026 13:44:31 -0800 Subject: [PATCH 9/9] release: MarkX 0.1.3 --- CHANGELOG.md | 11 +++++++++++ MarkX.psd1 | 13 +++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4923b8..451ac6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## MarkX 0.1.3: + +* Property Improvement: + * Late binding MarkX.DataSet (#44) +* New Properties: + * MarkX.Liquid ( #45 ) + * MarkX.LiquidPattern ( #46 ) + +--- + + ## MarkX 0.1.2: Minor performance improvements: diff --git a/MarkX.psd1 b/MarkX.psd1 index 42fc14a..466c622 100644 --- a/MarkX.psd1 +++ b/MarkX.psd1 @@ -12,7 +12,7 @@ RootModule = 'MarkX.psm1' # Version number of this module. -ModuleVersion = '0.1.2' +ModuleVersion = '0.1.3' # Supported PSEditions # CompatiblePSEditions = @() @@ -63,12 +63,13 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = @' -## MarkX 0.1.2: +## MarkX 0.1.3: -Minor performance improvements: - -* Directly using Markdig (#38) -* Preferring `[IO.File]::Exists` (#42) +* Property Improvement: + * Late binding MarkX.DataSet (#44) +* New Properties: + * MarkX.Liquid ( #45 ) + * MarkX.LiquidPattern ( #46 ) ---