scripts icon indicating copy to clipboard operation
scripts copied to clipboard

PlantUML does not render image

Open animeshkrishnabulusu opened this issue 4 years ago • 16 comments

Script name

Support for PlantUML in notes

Script authors

nikhilw, beurt

Expected behaviour

Write PlantUML and expect an image in the preview panel

Actual behaviour

Write PlantUML and image is not rendered in the preview panel. Instead a placeholder for image is displayed.

2021-01-24 00_31_21-Window

Steps to reproduce

  1. Install PlantUML plugin from script repository
  2. verify Java is available in PATH
  3. place plantuml.jar in a folder and specify it in the plugin settings

Output from the debug section in the settings dialog

QOwnNotes Debug Information

General Info

Current Date: Sun Jan 24 00:36:37 2021 Version: 21.1.7 Build date: Jan 23 2021 Build number: 808 Platform: windows Operating System: Windows 10 Version 2009 Build architecture: x86_64 Current architecture: x86_64 Release: GitHub Actions Qt Version (build): 5.15.2 Qt Version (runtime): 5.15.2 Portable mode: no Settings path / key: \HKEY_CURRENT_USER\Software\PBE\QOwnNotes Application database path: C:\Users\animesh\AppData\Roaming\PBE\QOwnNotes\QOwnNotes.sqlite Application arguments: C:\Users\animesh\programs\QOwnNotes\QOwnNotes.exe Qt Debug: 0 Locale (system): en_IN Locale (interface): empty Primary screen resolution: 1920x1080 Icon theme: breeze-qownnotes Notes in current note folder: 587 Calendar items: 0 Enabled scripts: 3

Server Info

serverUrl: empty appIsValid: no notesPathExists: empty connectionErrorMessage: empty

Spellchecking

Enabled: false Selected language: en_US Language codes: en_US Language names: American English (United States) Application dictionaries path: C:\Users\animesh\AppData\Roaming\PBE\QOwnNotes\dicts

Note folders

currentNoteFolderId: 1

Note folder default

id: 1 isCurrent: yes activeTagId: -1 localPath: C:\Users\animesh\Dropbox\notes remotePath: Notes cloudConnectionId: 1 isShowSubfolders: yes isUseGit: no activeNoteSubFolder name: architecture-and-design database file: C:\Users\animesh\Dropbox\notes\notes.sqlite

Cloud connections

Cloud connection Default

id: 1 isCurrent: yes serverUrl: empty username: empty

Enabled scripts

Script List maker

id: 1 path: C:\Users\animesh\AppData\Roaming\PBE\QOwnNotes\scripts\list-maker\list-maker.qml variablesJson:

{
    "setLetters": "abcdefghijklmnopqrstuvwxyz",
    "setMarkers": "- • ‣"
}

identifier: list-maker version: 0.0.2 minAppVersion: 17.07.8

Script Sort lines

id: 3 path: C:\Users\animesh\AppData\Roaming\PBE\QOwnNotes\scripts\sort-lines\sort-lines.qml variablesJson: empty identifier: sort-lines version: 1.0.0 minAppVersion: 18.04.3

Script Support for PlantUML in notes

id: 5 path: C:\Users\animesh\AppData\Roaming\PBE\QOwnNotes\scripts\render-plantuml\render-plantuml.qml variablesJson:

{
    "hideMarkup": false,
    "javaExePath": "java",
    "noStartUml": true,
    "plantumlJarPath": "C:\\Users\\animesh\\programs\\plantuml\\plantuml.jar",
    "workDir": "C:\\Users\\animesh\\programs\\tmp"
}

identifier: render-plantuml version: 0.0.8 minAppVersion: 20.6.0

Settings

AboutDialog/geometry (QByteArray): <binary data> ActionDialog/geometry (QByteArray): <binary data> ActiveNoteHistoryItem (NoteHistoryItem): <binary data> Debug/fakeOldVersionNumber (QString): false Debug/fileLogging (QString): true DictionaryManagerDialog/geometry (QByteArray): <binary data> DictionaryManagerDialog/mainSplitterState (QByteArray): <binary data> DistractionFreeMode/isEnabled (QString): false DistractionFreeMode/menuBarGeometry (QByteArray): <binary data> DistractionFreeMode/menuBarHeight (int): 21 DistractionFreeMode/menuBarVisible (QString): true DistractionFreeMode/windowState (QByteArray): <binary data> Editor/CurrentSchemaKey (QString): EditorColorSchema-6033d61b-cb96-46d5-a3a8-20d5172017eb Editor/autoBracketClosing (QString): true Editor/autoBracketRemoval (QString): true Editor/centerCursor (QString): false Editor/disableCursorBlinking (QString): false Editor/editorWidthInDFMOnly (QString): true Editor/highlightCurrentLine (QString): true Editor/indentSize (int): 4 Editor/removeTrailingSpaces (QString): false Editor/useTabIndent (QString): false Editor/vimMode (QString): false FileDialog/LastPath (QString): C:/Users/animesh/Downloads FileDialog/LastPath-NoteHTMLExport (QString): C:/Users/animesh/Downloads FileDialog/LastPath-PreviewHTMLFileExport (QString): C:/Users/animesh/Downloads FileDialog/LastPath-ScriptSettingsFile-render-plantuml-plantumlJarPath (QString): C:/Users/animesh/programs/plantuml IssueAssistantDialog/geometry (QByteArray): <binary data> LastUpdateCheck (QDateTime): 2021-01-24T00:16:35.747 LinkDialog/geometry (QByteArray): <binary data> LocalTrashDialog/geometry (QByteArray): <binary data> MainWindow/geometry (QByteArray): <binary data> MainWindow/mainToolBar.iconSize (int): 32 MainWindow/menuBarGeometry (QByteArray): <binary data> MainWindow/noteSubFolderTreeWidgetExpandState-1 (QStringList): general MainWindow/noteTextEdit.code.font (QString): Consolas,12,-1,5,50,0,0,0,0,0,Regular MainWindow/noteTextEdit.font (QString): Segoe UI,12,-1,5,50,0,0,0,0,0,Regular MainWindow/noteTextView.code.font (QString): Consolas,12,-1,5,50,0,0,0,0,0,Regular MainWindow/noteTextView.font (QString): Segoe UI,12,-1,5,50,0,0,0,0,0,Regular MainWindow/noteTextView.ignoreCodeFontSize (QString): true MainWindow/noteTextView.rtl (QString): false MainWindow/noteTextView.underline (QString): true MainWindow/noteTextView.useEditorStyles (QString): true MainWindow/noteTextView.useInternalExportStyling (QString): true MainWindow/showNotesFromAllNoteSubFolders (QString): false MessageBoxOverride/update-and-restart (int): 16384 NoteDiffDialog/geometry (QByteArray): <binary data> NoteFolder-1/NoteTabNameList (QStringList): test NoteFolder-1/NoteTabStickinessList (QStringList): empty NoteFolder-1/NoteTabSubFolderPathDataList (QStringList):

learning
architecture-and-design

NoteFolder-1/allowDifferentNoteFileName (QString): true NoteHistory-1 (QVariantList): <variant list with 200 item(s)> NoteHistoryCurrentIndex-1 (int): 199 PiwikClientId (QString): <hidden> ScriptRepositoryDialog/geometry (QByteArray): <binary data> ScriptRepositoryDialog/mainSplitterState (QByteArray): <binary data> SearchEngineId (int): 2 SettingsDialog/geometry (QByteArray): <binary data> SettingsDialog/mainSplitterState (QByteArray): <binary data> ShareDialog/geometry (QByteArray): <binary data> Shortcuts/MainWindow-customAction_list 123 (QString): Ctrl+Alt+L Shortcuts/MainWindow-togglePanel-notePreviewDockWidget (QString): Ctrl+Alt+W ShowSystemTray (QString): false StartHidden (QString): false TableDialog/geometry (QByteArray): <binary data> UpdateDialog/geometry (QByteArray): <binary data> WelcomeDialog/geometry (QByteArray): <binary data> acceptAllExternalModifications (QString): false allowNoteEditing (QString): true allowOnlyOneAppInstance (QString): true appMetrics/disableAppHeartbeat (QString): false appMetrics/disableTracking (QString): false appMetrics/notificationShown (QString): true automaticNoteFolderDatabaseClosing (QString): false checkSpelling (QString): false closeTodoListAfterSave (QString): false cryptoKey (qlonglong): <hidden> currentNoteFolderId (int): 1 currentWorkspace (QString): initial cursorWidth (int): 2 customNoteFileExtensionList (QStringList): empty darkMode (QString): false darkModeColors (QString): false darkModeIconTheme (QString): false darkModeTrayIcon (QString): true defaultNoteFileExtension (QString): md demoNotesCreated (QString): true disableAutomaticUpdateDialog (QString): false disableSavedSearchesAutoCompletion (QString): false dockWasInitializedOnce (QString): true enableNoteTree (QString): false enableSocketServer (QString): false externalEditorPath (QString): empty fullyHighlightedBlockquotes (QString): true gitCommitInterval (int): 30 gitExecutablePath (QString): empty gitLogCommand (QString): empty guiFirstRunInit (QString): true ignoreAllExternalModifications (QString): false ignoreAllExternalNoteFolderChanges (QString): false ignoreNoteSubFolders (QString): ^\. imageScaleDown (QString): true imageScaleDownMaximumHeight (int): 480 imageScaleDownMaximumWidth (int): 480 initialLayoutIdentifier (QString): minimal insertTimeFormat (QString): empty interfaceFontSize (int): 11 interfaceLanguage (QString): empty internalIconTheme (QString): false itemHeight (int): 16 legacyLinking (QString): false localTrash/autoCleanupDays (int): 30 localTrash/autoCleanupEnabled (QString): true localTrash/supportEnabled (QString): true localTrashSplitterSizes (QByteArray): <binary data> markdownHighlightingEnabled (QString): true navigationPanelHideSearch (QString): false networking/ignoreSSLErrors (QString): true networking/proxyType (int): 2 newNoteAskHeadline (QString): true noteEditIsCentralWidget (QString): true noteListPreview (QString): false noteSaveIntervalTime (int): 300 noteSubfoldersPanelDisplayAsFullTree (QString): true noteSubfoldersPanelHideSearch (QString): false noteSubfoldersPanelOrder (int): 0 noteSubfoldersPanelShowFullPath (QString): false noteSubfoldersPanelShowNotesRecursively (QString): false noteSubfoldersPanelShowRootFolderName (QString): true noteSubfoldersPanelSort (int): 0 notesPanelOrder (int): 0 notesPanelSort (int): 1 notesPath (QString): C:/Users/animesh/Dropbox/notes notifyAllExternalModifications (QString): true overrideInterfaceFontSize (QString): false ownCloud/supportEnabled (QString): false ownCloud/todoCalendarBackend (int): 3 ownCloud/todoCalendarCalDAVPassword (QString): <hidden> ownCloud/todoCalendarCalDAVServerUrl (QString): empty ownCloud/todoCalendarCalDAVUsername (QString): empty ownCloud/todoCalendarCloudConnectionId (int): 1 ownCloud/todoCalendarDisplayNameList (QStringList): empty ownCloud/todoCalendarEnabledList (QStringList): empty ownCloud/todoCalendarEnabledUrlList (QStringList): empty ownCloud/todoCalendarUrlList (QStringList): empty ownCloudInfo/appIsValid (QString): false ownCloudInfo/connectionErrorMessage (QString): empty ownCloudInfo/notesPathExistsText (QString): empty ownCloudInfo/serverVersion (QString): empty previousWorkspace (QString): initial restoreCursorPosition (QString): true restoreLastNoteAtStartup (QString): true restoreNoteTabs (QString): true savedSearches/noteFolder-1 (QStringList): test, repairWorks, dec032020, dec022020, dec012020, nov302020, nov292020, nov062020, nov052020, nov042020, nov032020, nov022020, nov012020, oct312020, oct302020, oct292020, oct282020, oct272020, oct232020, oct222020, oct212020, webpack, oct202020, oct192020, pa11y, oct182020, oct172020, oct162020, oct152020, oct142020, oct122020, oct112020, oct102020, oct092020, oct082020, oct072020, oct062020, oct052020, oct042020, oct032020, oct022020, oct012020, sep302020, sep292020, sep282020, sep272020, sep262020, sep242020, sep222020, sep212020, reinstall, sep202020, sep192020, sep182020, sep172020, sep162020, sep152020, sep142020, sep132020, sep122020, sep112020, sep102020, sep092020, sep082020 showMatches (QString): true showMenuBar (QString): true showStatusBar (QString): true skipVersion (QString): 21.1.3 spellCheckLanguage (QString): en_US systemIconTheme (QString): false tagWasAddedToNote (QString): true taggingShowNotesRecursively (QString): false tagsPanelHideNoteCount (QString): false tagsPanelHideSearch (QString): false tagsPanelOrder (int): 0 tagsPanelSort (int): 0 todoCalendarSupport (QString): false toolbar/1/items (QStringList): action_New_note, action_Find_note, action_Remove_note, action_Open_note_in_external_editor, actionShow_local_trash, actionAllow_note_editing, , action_Back_in_note_history, action_Forward_in_note_history, , action_Find_text_in_note, actionReplace_in_current_note, , actionShow_versions, actionShow_trash, actionShare_note, , actionOpen_List toolbar/1/name (QString): mainToolBar toolbar/1/title (QString): main toolbar toolbar/2/items (QStringList): actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote toolbar/2/name (QString): formattingToolbar toolbar/2/title (QString): formatting toolbar toolbar/3/items (QStringList): actionInsert_Link_to_note, actionInsert_image, actionInsert_current_time toolbar/3/name (QString): insertingToolbar toolbar/3/title (QString): inserting toolbar toolbar/4/items (QStringList): action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note toolbar/4/name (QString): encryptionToolbar toolbar/4/title (QString): encryption toolbar toolbar/5/items (QStringList): actionWorkspaceComboBox, actionStore_as_new_workspace, actionRemove_current_workspace, actionRename_current_workspace, actionSwitch_to_previous_workspace, actionUnlock_panels, , actionToggle_distraction_free_mode, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size toolbar/5/name (QString): windowToolbar toolbar/5/title (QString): window toolbar toolbar/6/items (QStringList): action_Quit toolbar/6/name (QString): quitToolbar toolbar/6/title (QString): quit toolbar toolbar/size (int): 6 useNoteFolderButtons (QString): false useUNIXNewline (QString): false webSocketServerService/bookmarksNoteName (QString): Bookmarks webSocketServerService/bookmarksTag (QString): bookmarks webSocketServerService/port (int): 22222 workspace-initial/name (QString): Minimal workspace-initial/noteSubFolderDockWidgetVisible (QString): true workspace-initial/windowState (QByteArray): <binary data> workspaces (QStringList): initial

System environment

ALLUSERSPROFILE: C:\ProgramData APPDATA: C:\Users\animesh\AppData\Roaming CommonProgramFiles: C:\Program Files\Common Files CommonProgramFiles(x86): C:\Program Files (x86)\Common Files CommonProgramW6432: C:\Program Files\Common Files ComSpec: C:\WINDOWS\system32\cmd.exe configsetroot: C:\WINDOWS\ConfigSetRoot DriverData: C:\Windows\System32\Drivers\DriverData HOMEDRIVE: C: HOMEPATH: \Users\animesh JAVA_HOME: C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-openj9\ LOCALAPPDATA: C:\Users\animesh\AppData\Local OS: Windows_NT Path: C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-openj9\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\dotnet\;C:\Program Files\Git\cmd;C:\Users\animesh\AppData\Local\Microsoft\WindowsApps;C:\Users\animesh\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\animesh\.dotnet\tools;C:\Users\animesh\AppData\Local\lektor-cli;C:\Users\animesh\programs;C:\Program Files\Java\jdk-13.0.1\bin PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE: AMD64 PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 158 Stepping 10, GenuineIntel PROCESSOR_LEVEL: 6 PROCESSOR_REVISION: 9e0a ProgramData: C:\ProgramData ProgramFiles: C:\Program Files ProgramFiles(x86): C:\Program Files (x86) ProgramW6432: C:\Program Files PSModulePath: %ProgramFiles%\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules\ PUBLIC: C:\Users\Public SystemDrive: C: SystemRoot: C:\WINDOWS TEMP: C:\Users\animesh\AppData\Local\Temp TMP: C:\Users\animesh\AppData\Local\Temp USERNAME: animesh USERPROFILE: C:\Users\animesh windir: C:\WINDOWS

Relevant log output in the Log panel

animeshkrishnabulusu avatar Jan 23 '21 19:01 animeshkrishnabulusu

@nikhilw, @beurt?

pbek avatar Jan 23 '21 21:01 pbek

Is there any useful log output if you enable the log panel (see Window / Panels)? Please make sure you also enable debug logging in the log panel (by right-clicking on the panel and and selecting Debug in Options).

pbek avatar Jan 23 '21 21:01 pbek

Log panel output with all options enabled:

[08:22:57] [debug] on_noteTreeWidget_itemSelectionChanged
[08:22:57] [debug] setCurrentNote - 'note': Note: <id>489 <name>"test" <fileName>"test.md" <noteSubFolderId>10 <relativePath>"learning/architecture-and-design" <hasDirtyData>false - 'updateNoteText': true - 'updateSelectedNote': false
[08:23:03] [debug] added to history: NoteHistoryItem: <noteName>"test" <noteSubFolderPathData>"learning\narchitecture-and-design" <cursorPosition>28 <relativeScrollBarPosition>0

The debug log does not seem to contain any action either:

[Jan 24 08:27:39] [debug]: Set proxy configuration to use NO proxy
[Jan 24 08:27:42] [scripting]: loading script file: C:/Users/animesh/AppData/Roaming/PBE/QOwnNotes/scripts/list-maker/list-maker.qml
[Jan 24 08:27:42] [scripting]: loading script file: C:/Users/animesh/AppData/Roaming/PBE/QOwnNotes/scripts/sort-lines/sort-lines.qml
[Jan 24 08:27:42] [scripting]: loading script file: C:/Users/animesh/AppData/Roaming/PBE/QOwnNotes/scripts/render-plantuml/render-plantuml.qml
[Jan 24 08:27:42] [debug]: initShortcuts  - 'menuBarIsVisible':  true
[Jan 24 08:27:42] [debug]: cloudConnection:  CloudConnection: <id>1 <name>"Default" <serverUrl>"" <username>"" <priority>1
[Jan 24 08:27:42] [debug]: buildNotesIndex  - 'noteSubFolderId':  0
[Jan 24 08:27:42] [debug]: storing note file:  "test.md"
[Jan 24 08:27:42] [debug]: stored note:  Note: <id>489 <name>"test" <fileName>"test.md" <noteSubFolderId>10 <relativePath>"learning/architecture-and-design" <hasDirtyData>false
[Jan 24 08:27:42] [debug]: storeUpdatedNotesToDisk  - 'count':  1
[Jan 24 08:27:42] [status]: Stored 1 note(s) to disk
[Jan 24 08:27:43] [debug]: setupNoteFolderTables  - 'database version':  14
[Jan 24 08:27:43] [debug]: cloudConnection:  CloudConnection: <id>1 <name>"Default" <serverUrl>"" <username>"" <priority>1
[Jan 24 08:27:43] [debug]: loadNoteDirectoryList
[Jan 24 08:27:44] [debug]: reloadTagTree
[Jan 24 08:27:44] [debug]: reloadTagTree  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:44] [debug]: filterNotesByNoteSubFolders  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:44] [debug]: reloadNoteSubFolderTree
[Jan 24 08:27:44] [debug]: filterNotesByNoteSubFolders  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:44] [debug]: reloadNoteSubFolderTree
[Jan 24 08:27:44] [debug]: loadNoteDirectoryList
[Jan 24 08:27:44] [debug]: reloadTagTree
[Jan 24 08:27:44] [debug]: reloadTagTree  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:44] [debug]: filterNotesByNoteSubFolders  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:44] [debug]: reloadNoteSubFolderTree
[Jan 24 08:27:44] [debug]: filterNotesByNoteSubFolders  - 'noteSubFolderIds':  QVector(10)
[Jan 24 08:27:47] [debug]: on_noteTreeWidget_itemSelectionChanged
[Jan 24 08:27:47] [debug]: setCurrentNote  - 'note':  Note: <id>488 <name>"design-patterns" <fileName>"design-patterns.md" <noteSubFolderId>10 <relativePath>"learning/architecture-and-design" <hasDirtyData>false  - 'updateNoteText':  true  - 'updateSelectedNote':  false
[Jan 24 08:27:47] [debug]:  added to history:  NoteHistoryItem: <noteName>"design-patterns" <noteSubFolderPathData>"learning\narchitecture-and-design" <cursorPosition>166 <relativeScrollBarPosition>0
[Jan 24 08:27:51] [debug]: on_noteTreeWidget_itemSelectionChanged
[Jan 24 08:27:51] [debug]: setCurrentNote  - 'note':  Note: <id>489 <name>"test" <fileName>"test.md" <noteSubFolderId>10 <relativePath>"learning/architecture-and-design" <hasDirtyData>false  - 'updateNoteText':  true  - 'updateSelectedNote':  false
[Jan 24 08:27:51] [debug]:  added to history:  NoteHistoryItem: <noteName>"test" <noteSubFolderPathData>"learning\narchitecture-and-design" <cursorPosition>445 <relativeScrollBarPosition>0

animeshkrishnabulusu avatar Jan 24 '21 03:01 animeshkrishnabulusu

Within the exported HTML, I see the path of the image like this:

<img src="file://C:\Users\animesh\programs\tmp/488_2.png?t=1611457999586" alt="Wait for it..">

This image does not exist in this path.

I opened the tmp folder side by side to see if anything is being generated when I enter new PlantUML script and nothing seems to get generated

animeshkrishnabulusu avatar Jan 24 '21 03:01 animeshkrishnabulusu

Did some poking around with console logs 😅 in the qml file. I don't know if this effort is any worth, but I had some fun. This is from the log panel:

[09:59:23] [debug] filePath: C:\Users\animesh\programs\tmp/488_1
[09:59:24] [debug] params to node: [-e,require('fs').writeFileSync('C:\Users\animesh\programs\tmp/488_1', "@startuml\nBob -> Alice: Hello!\n@enduml\n", 'utf8');]
[09:59:24] [debug] plantumlFiles: [C:\Users\animesh\programs\tmp/488_1]
[09:59:24] [debug] plantumlJarPath: C:\Users\animesh\programs\plantuml\plantuml.jar

The node command when executed with the params on the command line throws an error:

node -e require('fs').writeFileSync('C:\Users\animesh\programs\tmp/488_1', "@startuml\nBob -> Alice: Hello!\n@enduml\n", 'utf8');

[eval]:1
require('fs').writeFileSync('C:\Users\animesh\programs\tmp/488_1',


SyntaxError: Unexpected end of input
←[90m    at new Script (vm.js:88:7)←[39m
←[90m    at createScript (vm.js:263:10)←[39m
←[90m    at Object.runInThisContext (vm.js:311:10)←[39m
    at Object.<anonymous> ([eval]-wrapper:10:26)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1158:30)←[39m
←[90m    at evalScript (internal/process/execution.js:94:25)←[39m
←[90m    at internal/main/eval_string.js:23:3←[39m

This command works however:

node -e require('fs').writeFileSync('C:\\Users\\animesh\\programs\\tmp\\4887',"11111111111",'utf8');

I suspect it has to do with how node handles path on Windows.

animeshkrishnabulusu avatar Jan 24 '21 04:01 animeshkrishnabulusu

Hi,

I think there is problems with slashes with Windows. In the code it is probably here:

https://github.com/qownnotes/scripts/blob/6e7b89a575cae7ed1da1af0d9d418471dd383046/render-plantuml/render-plantuml.qml#L98

and here:

https://github.com/qownnotes/scripts/blob/6e7b89a575cae7ed1da1af0d9d418471dd383046/render-plantuml/render-plantuml.qml#L117

I don't have Windows so I cannot test. But if you can try to modify the code, you should maybe try to use https://doc.qt.io/qt-5/qdir.html#toNativeSeparators. Since I did not write this code I am not sure about that!

Beurt avatar Jan 24 '21 09:01 Beurt

There are scripting methods for separator conversion: https://www.qownnotes.org/scripting/methods-and-objects.html#converting-path-separators-to-native-ones

pbek avatar Jan 24 '21 10:01 pbek

Hello @pbek and @Beurt, good day!

Apologies for the delay in responding to this issue. Today I got a chance to dig deeper than my previous attempt and after some testing got some progress. I realized that the workDir is the first culprit.

https://github.com/qownnotes/scripts/blob/6e7b89a575cae7ed1da1af0d9d418471dd383046/render-plantuml/render-plantuml.qml#L76

After replacing single slashes with double slashes using regex replace, I see that the plantuml images got generated in the workDir location.

var filePath = workDir.replace(/\\/gm,"\\\\") + "/" + note.id + "_" + (++index);

However, the markdown preview does not still display the images. The updatedHtml is as follows:

<div><img src="file://C:\\Users\\animesh\\programs\\tmp/519_1.png?t=1618234319478" alt="Wait for it.."/></div>
<div><img src="file://C:\\Users\\animesh\\programs\\tmp/519_2.png?t=1618234319478" alt="Wait for it.."/></div>

and I can export the html and preview it in external browser just fine.

Kindly advise next steps.

animeshkrishnabulusu avatar Apr 12 '21 13:04 animeshkrishnabulusu

I noticed that when I right click and copy the image path directly from the preview panel, the path shows up as //c/519_2.png

animeshkrishnabulusu avatar Apr 12 '21 13:04 animeshkrishnabulusu

You can always export the raw html in the preview panel to debug the script code more easily.

pbek avatar Apr 12 '21 13:04 pbek

Yes, I did that. As in the code snippet above, the raw html exported has the paths properly injected and I can open html file with plantuml images in Firefox.

animeshkrishnabulusu avatar Apr 12 '21 14:04 animeshkrishnabulusu

  • I'm not sure how file urls with url parameters like file://C:\\Users\\animesh\\programs\\tmp/519_2.png?t=1618234319478 are handled.
  • Im not sure about backslashes neither...

best use an url schema like stated in https://en.wikipedia.org/wiki/File_URI_scheme

e.g. file:///c:/WINDOWS/clock.avi (yes, 3 slashes at the beginning!)

pbek avatar Apr 12 '21 14:04 pbek

Great, that fixed it.

If I can verify that it works on Linux and follow the contribution guidelines, can I raise a PR?

animeshkrishnabulusu avatar Apr 12 '21 18:04 animeshkrishnabulusu

Of course! There are also script methods to check the OS if you need to do things differently on different OSes.

pbek avatar Apr 12 '21 18:04 pbek

Hi @anmsh!

I've been working on some important changes on render-plantuml script. And, I just introduced on new PR (https://github.com/qownnotes/scripts/pull/158) that should solve your problem. It is working well on Linux. Can you Try on Windows?

Beurt avatar Mar 06 '22 21:03 Beurt

I will check this @Beurt. Thank you.

animeshkrishnabulusu avatar May 01 '22 09:05 animeshkrishnabulusu

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 04 '23 15:04 github-actions[bot]

I have recently used plantuml heavily on both Linux and Windows especially with 1.2023.3 and 1.2023.5. I will document the behaviour in a few days.

animeshkrishnabulusu avatar Apr 04 '23 18:04 animeshkrishnabulusu

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 05 '23 02:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 19 '23 02:05 github-actions[bot]

Apologies for not responding on time for this as specified on this issue.

Here are my observations on Windows 10, QOwnNotes 23.9.0, Support for plantuml plugin 0.1.5

Today I verified that it was working to my pleasant surprise. 😮😀

I have the plantuml-1.2023.5.jar installed directly from the plantuml website.

Settings:

Path to plantuml jar:
C:/Users/animesh/programs/plantuml/plantuml-1.2023.5.jar

Working directory:
C:/Users/animesh/programs/tmp/plantuml/

Hide plantuml markup:
Yes

No need for @startuml/@enduml:
Yes

Image output format:
PNG

image

image

@pbek, @cristianofromagio

animeshkrishnabulusu avatar Sep 04 '23 16:09 animeshkrishnabulusu

Thank you for testing 😉

pbek avatar Sep 04 '23 18:09 pbek