puml-for-markdown
puml-for-markdown copied to clipboard
Broken on windows
I get this error:
C:\..\..\..\..\src\main\java\be\..\ce\..\docs structurizr +3 | ?33 ~5 puml-for-markdown
Processing md file at C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/01-context.md
FATAL EXCEPTION
Error: Could not find puml for md link path = ./puml/a.puml, absolute path = C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\puml\a.puml
at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:171:23
at String.replace (<anonymous>)
at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:167:20
at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:38:16
at Array.map (<anonymous>)
at replaceIgnore (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:36:45)
at replaceMdIgnoringInlineCode (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:44:12)
at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:52:57
at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:38:16
at Array.map (<anonymous>)
at replaceIgnore (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:36:45)
at replaceMdIgnoringCodeBlocks (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:48:12)
at replaceMdIgnoringCode (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:52:12)
at processMdFile (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:166:36)
at runOnce (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:216:34)
But the puml file is there, it's in the path C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\puml\a.puml.
The .../docs folder contains the file 01-context.md:
<!-- -->
The .../docs/puml folder contains the file a.puml:
@startuml
class User {
-String id
-String name
+String name()
}
User <|-- SpecificUser
@enduml
Plz note that I am on Windows. Placing the file in the same folder than the md file doesn't help. It doesn't find the puml-file while it is right there where it expects it !
I think it is the same issue than https://github.com/danielyaa5/puml-for-markdown/issues/5 but the error msg is a bit different.
I debugged it.
It's due to forward vs backward slash problem :/
In the map pumlLinks you have a key: 'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/puml/aggregate-timespendlapse.puml':
[
[
'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/aggregate-timespendlapse.puml',
{
encodedData: 'SoWkIImgAStDuULApaaiBbO8BKujKgZcvL9Gq0qkAShCIrV8J47cvINcfeBusaXy3KrUhbfUBh1McnfTNONWWjJapBJCP908BvT3QbuAq0O0',
url: 'https://tinyurl.com/2atnl4pe',
....
But the pumlPath that is resolved is 'C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\aggregate-timespendlapse.puml'
This has backward slashes on Windows !!
So pumlPath is never found in pumlLinks.
So this fixes it: at line 168 in index.js:
const pumlPath = path.resolve(path.dirname(mdPath), mdPumlLinkPath).replaceAll('\\','/')
I believe it is more than that. Seems it works on Linux, but not on Windows.
It looks for a path with forward slashes like: D:/repos/fhi/lmr/Fhi.Legemiddelregisteret.wiki/Testing/miljoer.md
But crashes when trying to get it using backwards slashes.
D:\repos\fhi\lmr\Fhi.Legemiddelregisteret.wiki\Testing\miljoer.puml
No way of trying to change the slashes back or forward helps.
@OsirisTerje @cbonami unfortunately I don't have a windows machine to test this on, if you find a fix, would you mind opening a PR?
I debugged it.
It's due to forward vs backward slash problem :/
In the map pumlLinks you have a key: 'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/puml/aggregate-timespendlapse.puml':
[ [ 'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/aggregate-timespendlapse.puml', { encodedData: 'SoWkIImgAStDuULApaaiBbO8BKujKgZcvL9Gq0qkAShCIrV8J47cvINcfeBusaXy3KrUhbfUBh1McnfTNONWWjJapBJCP908BvT3QbuAq0O0', url: 'https://tinyurl.com/2atnl4pe', ....
But the pumlPath that is resolved is 'C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\aggregate-timespendlapse.puml'
This has backward slashes on Windows !!
So pumlPath is never found in pumlLinks.
So this fixes it: at line 168 in index.js:
const pumlPath = path.resolve(path.dirname(mdPath), mdPumlLinkPath).replaceAll('\\','/')
I made this change but still getting error.
@scmay can you provide us with the full logs?
yes originally wanted to send via Twitter DM (I cannot post publicly, contains sensitive info) but realised I couldn't send a private DM. I went down another solution route so I've lost the logs.
On Thu, Sep 1, 2022 at 2:07 AM Daniel @.***> wrote:
@scmay https://github.com/scmay can you provide us with the full logs?
— Reply to this email directly, view it on GitHub https://github.com/danielyaa5/puml-for-markdown/issues/6#issuecomment-1233136574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJNMIKIV3CS3VHS4JXR33DV357KRANCNFSM542DCOOA . You are receiving this because you were mentioned.Message ID: @.***>