-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Bug
During conversion, it fails to rename the reference of each image found.
It successfully creates & moves the images, but when renaming the references in markdown, the script fails for EVERY picture. (drawings as well)
Expectation
Renaming the file references should work, considering the files were moved properly.
Discussion
I renamed my username and the name of the Notebook for privacy purposes. The format stayed the same though, just used a different name for both.
Here is a sample output of the script: (it throws a lot of errors because of the amount of images)
VERBOSE: Moving image: C:\Users\user\AppData\Local\Temp\My-Notebook\2022-03-01-00-17-57-5426867\media\image7.png to C:\Users
\user\Desktop\tmp\My-Notebook\Allgemeines---Globale-Themen\Vorbereitung-Reihungstest\media\Chemie-image7.png
VERBOSE: Mutation of markdown: Rename image references to unique name. Find 'image7.png', Replacement: 'Chemie-image7.png'
Convert-OneNotePage : Error while renaming image file name references to 'Chemie-image7.png: Illegal characters in path.
At D:\#Git-Stash\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown-v2.ps1:1387 char:257
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VERBOSE: Moving image: C:\Users\user\AppData\Local\Temp\My-Notebook\2022-03-01-00-17-57-5426867\media\image70.png to C:\User
s\user\Desktop\tmp\My-Notebook\Allgemeines---Globale-Themen\Vorbereitung-Reihungstest\media\Chemie-image70.png
VERBOSE: Mutation of markdown: Rename image references to unique name. Find 'image70.png', Replacement: 'Chemie-image70.png'
Convert-OneNotePage : Error while renaming image file name references to 'Chemie-image70.png: Illegal characters in path.
At D:\#Git-Stash\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown-v2.ps1:1387 char:257
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VERBOSE: Moving image: C:\Users\user\AppData\Local\Temp\My-Notebook\2022-03-01-00-17-57-5426867\media\image71.png to C:\User
s\user\Desktop\tmp\My-Notebook\Allgemeines---Globale-Themen\Vorbereitung-Reihungstest\media\Chemie-image71.png
VERBOSE: Mutation of markdown: Rename image references to unique name. Find 'image71.png', Replacement: 'Chemie-image71.png'
Convert-OneNotePage : Error while renaming image file name references to 'Chemie-image71.png: Illegal characters in path.
At D:\#Git-Stash\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown-v2.ps1:1387 char:257
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VERBOSE: Moving image: C:\Users\user\AppData\Local\Temp\My-Notebook\2022-03-01-00-17-57-5426867\media\image72.png to C:\User
s\user\Desktop\tmp\My-Notebook\Allgemeines---Globale-Themen\Vorbereitung-Reihungstest\media\Chemie-image72.png
VERBOSE: Mutation of markdown: Rename image references to unique name. Find 'image72.png', Replacement: 'Chemie-image72.png'
Convert-OneNotePage : Error while renaming image file name references to 'Chemie-image72.png: Illegal characters in path.
At D:\#Git-Stash\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown-v2.ps1:1387 char:257
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is a sample from the converted markdown file, containing a reference, which can't be renamed:
Chemie
{width="0.8125in" height="1.2708333333333333in"}{width="0.8611111111111112in" height="1.2569444444444444in"}{width="0.9375in" height="0.7569444444444444in"}{width="0.8819444444444444in" height="1.0416666666666667in"}{width="0.9375in" height="1.0833333333333333in"}{width="0.8611111111111112in" height="1.0in"}{width="0.7986111111111112in" height="0.9930555555555556in"}{width="0.8819444444444444in" height="1.0347222222222223in"}{width="0.8194444444444444in" height="0.9513888888888888in"}{width="0.875in" height="0.9930555555555556in"}{width="1.0in" height="0.9513888888888888in"}{width="0.875in" height="0.9583333333333334in"}{width="0.8125in" height="0.8958333333333334in"}{width="0.875in" height="0.9930555555555556in"}{width="1.0347222222222223in" height="0.9027777777777778in"}
Saturday, 29 February 2020
14:49
{width="0.9027777777777778in" height="1.0833333333333333in"}{width="0.875in" height="1.125in"}{width="1.4583333333333333in" height="1.4722222222222223in"}{width="0.7708333333333334in" height="1.0in"}{width="0.8194444444444444in" height="1.1041666666666667in"}{width="0.9236111111111112in" height="1.0416666666666667in"}{width="0.8402777777777778in" height="0.9930555555555556in"}{width="0.8958333333333334in" height="0.9166666666666666in"}{width="0.8611111111111112in" height="0.8958333333333334in"}{width="0.8958333333333334in" height="0.8819444444444444in"}{width="0.8333333333333334in" height="0.8541666666666666in"}{width="0.9236111111111112in" height="0.8958333333333334in"}{width="0.8958333333333334in" height="0.8819444444444444in"}{width="0.8194444444444444in" height="0.9722222222222222in"}{width="0.9027777777777778in" height="0.9236111111111112in"}{width="2.5in" height="1.8263888888888888in"}{width="0.8125in" height="0.8333333333333334in"}{width="1.6875in" height="1.6875in"}{width="1.0833333333333333in" height="1.4930555555555556in"}{width="1.4375in" height="1.625in"}{width="5.25in" height="5.493055555555555in"}{width="0.3958333333333333in" height="5.555555555555555in"}
<https://www.youtube.com/watch?v=J2KJRRH0E3Y>
<https://www.youtube.com/watch?v=f5-W87IGLFY>
simpleClub =\> Youtube
{width="1.2708333333333333in" height="1.4722222222222223in"}{width="0.4444444444444444in" height="0.5763888888888888in"}{width="0.4375in" height="0.5763888888888888in"}{width="0.4236111111111111in" height="0.5486111111111112in"}{width="1.0in" height="1.3680555555555556in"}{width="0.3333333333333333in" height="0.4444444444444444in"}{width="0.75in" height="0.7916666666666666in"}{width="1.0208333333333333in" height="1.2916666666666667in"}{width="0.7569444444444444in" height="1.1666666666666667in"}{width="0.7430555555555556in" height="0.7916666666666666in"}{width="0.8125in" height="1.25in"}{width="0.7986111111111112in" height="1.3263888888888888in"}{width="0.8541666666666666in" height="1.375in"}{width="0.9236111111111112in" height="1.2083333333333333in"}{width="1.0833333333333333in" height="1.875in"}{width="0.9930555555555556in" height="0.7916666666666666in"}{width="0.8958333333333334in" height="0.9513888888888888in"}{width="0.8333333333333334in" height="1.0138888888888888in"}{width="0.5486111111111112in" height="0.6666666666666666in"}{width="0.8819444444444444in" height="0.9236111111111112in"}{width="0.9236111111111112in" height="0.75in"}{width="0.8958333333333334in" height="0.9722222222222222in"}{width="0.8194444444444444in" height="0.9027777777777778in"}{width="0.9722222222222222in" height="0.9166666666666666in"}{width="0.8125in" height="0.9722222222222222in"}{width="0.8611111111111112in" height="0.9375in"}{width="0.7777777777777778in" height="0.9166666666666666in"}{width="0.8402777777777778in" height="0.8402777777777778in"}{width="0.875in" height="0.9236111111111112in"}{width="0.8819444444444444in" height="1.1319444444444444in"}{width="0.8958333333333334in" height="0.8819444444444444in"}{width="0.8541666666666666in" height="1.0763888888888888in"}{width="0.9166666666666666in" height="1.1944444444444444in"}{width="0.8402777777777778in" height="1.0625in"}{width="0.9027777777777778in" height="0.9930555555555556in"}{width="1.2291666666666667in" height="1.0347222222222223in"}{width="0.8611111111111112in" height="1.2986111111111112in"}{width="3.5625in" height="1.875in"}{width="0.875in" height="1.1736111111111112in"}
Erdöl
Einheiten
Bindungen
Säuren & Basen (PH-Wert)
Environment
Windows 11 Pro - 10.0.22000
I ran the script as administrator inside ISE and also ran OneNote (Office-Version) as Administrator
Aside from the images & drawings, the conversion works well.
Output of Configuration
For example:
$dryRun = 1
$notesdestpath = 'C:\Users\user\Desktop\tmp'
$targetNotebook = 'My Notebook'
$usedocx = 1
$keepdocx = 1
$docxNamingConvention = 2
$prefixFolders = 1
$mdFileNameAndFolderNameMaxLength = 32
$medialocation = 2
$conversion = 'markdown-simple_tables-multiline_tables-grid_tables+pipe_tables'
$headerTimestampEnabled = 1
$keepspaces = 1
$keepescape = 1
$newlineCharacter = 1
$exportPdf = 2Output of $PSVersionTable
For example:
PS > $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22000.282
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.282
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1