Add a TableTitle property to ConvertTo-Markdown
mdcaddic opened this issue · comments
Hi Jeff,
I wanted to be able to add a Table Caption for configuration doco so that I can output via pandoc after initial output to markdown. Changes to ConvertTo-Markdown are show in bold below and I have successfully tested this using this syntax.
Get-HotFix | Select-Object Hotfixid, Description | ConvertTo-Markdown -Title "Hotfixes" -TableTitle "Lists" -AsTable | Out-File -Encoding utf8 C:\github\hotfixes.md
pandoc .\hotfixes.md -o .\hotfixes.docx --reference-doc=doco\templates\Template.docx
Param(
[Parameter(Position = 0, ValueFromPipeline)]
[object]$Inputobject,
[Parameter()]
[string]$Title,
**[string]$TableTitle,**
[string[]]$PreContent,
[string[]]$PostContent,
[ValidateScript( {$_ -ge 10})]
[int]$Width = 80,
#display results as a markdown table
[switch]$AsTable
)
Begin {
Write-Verbose "[BEGIN ] Starting $($myinvocation.MyCommand)"
#initialize an array to hold incoming data
$data = @()
#initialize an empty here string for markdown text
$Text = @"
"@
If ($title) {
Write-Verbose "[BEGIN ] Adding Title: $Title"
$Text += "# $Titlen
n"
}
If ($precontent) {
Write-Verbose "[BEGIN ] Adding Precontent"
$Text += $precontent
$text += "n
n"
}
**If ($TableTitle) {
Write-Verbose "[BEGIN ] Adding Table Title: $TableTitle"
$text += ": $TableTitle"
$text += "`n`n"
}**
I was just wrapping up a new update so let me see about adding this.
I have looked into this, and as far as I can tell there is no support for captions in generic markdown, which is what I am trying to support. There are plenty of variations and extensions like Pandoc that might support captions. I don't think I can make this change. If you need Pandoc support, I suggest you take the code and create your own version of the function. I'd suggest using a different name so you don't conflict with the module.
Since this is not a feature supported in generic markdown, there are no changes I can make. I think you'll need to take may function as a starting point for your own solution that outputs markdown that works with your Pandoc workflow.