Skip to content

Commit

Permalink
Fix (configuration): Add support for $notesdestpath config option t…
Browse files Browse the repository at this point in the history
…o contain spaces

Closes #163
  • Loading branch information
leojonathanoh committed Jul 10, 2023
1 parent 07c9175 commit 872af21
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ConvertOneNote2MarkDown-v2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,23 @@ Function Convert-OneNotePage {
# Start-Process has no way of capturing stderr / stdterr to variables, so we need to use temp files.
"Converting docx file to markdown file: $( $pageCfg['filePath'] )" | Write-Verbose
if (!$config['dryRun']['value']) {
$argumentList = @( '-f', 'docx', '-t', $pageCfg['conversion'], '-i', $pageCfg['docxExportFilePath'], '-o', $pageCfg['filePathNormal'], '--wrap=none', '--markdown-headings=atx', "--extract-media=$( $pageCfg['mediaParentPathPandoc'] )" )
$argumentList = @(
'-f'
'docx'
'-t'
$pageCfg['conversion']
'-i'
$pageCfg['docxExportFilePath']
'-o'
if ($pageCfg['filePathNormal'] -match ' ') {
"`"$( $pageCfg['filePathNormal'] )`""
}else {
$pageCfg['filePathNormal']
}
'--wrap=none'
'--markdown-headings=atx'
"--extract-media=$( $pageCfg['mediaParentPathPandoc'] )"
)
"Command line: pandoc.exe $argumentList" | Write-Verbose
$process = Start-Process -ErrorAction Stop -RedirectStandardError $stderrFile -PassThru -NoNewWindow -Wait -FilePath pandoc.exe -ArgumentList $argumentList # extracts into ./media of the supplied folder
if ($process.ExitCode -ne 0) {
Expand Down

0 comments on commit 872af21

Please sign in to comment.