diff --git a/frontend/app.js b/frontend/app.js index 0e6bb7a..849b33f 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -734,8 +734,9 @@ function noteApp() { const notePath = this.draggedNoteForLink; const noteName = notePath.split('/').pop().replace('.md', ''); - // Create markdown link - const link = `[${noteName}](${notePath})`; + // Create markdown link (URL-encode the path to handle spaces and special characters) + const encodedPath = notePath.split('/').map(segment => encodeURIComponent(segment)).join('/'); + const link = `[${noteName}](${encodedPath})`; // Insert at cursor position const textarea = event.target; @@ -775,7 +776,8 @@ function noteApp() { event.preventDefault(); // Remove any anchor from the href (e.g., "note.md#section" -> "note.md") - const notePath = href.split('#')[0]; + // Also decode URL encoding (e.g., "note%203.md" -> "note 3.md") + const notePath = decodeURIComponent(href.split('#')[0]); // Skip if it's just an anchor link if (!notePath) return; @@ -2424,11 +2426,11 @@ function noteApp() { ${noteName} - + ${highlightTheme ? `` : ''} - + - + - + + + - - + + - - + + - + - + @@ -57,9 +57,9 @@ - +