Skip to content

Commit 563bf7c

Browse files
author
Guillermo Villar
committed
fixed note names with spaces
also pinned versions of CDN libraries
1 parent a691972 commit 563bf7c

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

frontend/app.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,9 @@ function noteApp() {
734734
const notePath = this.draggedNoteForLink;
735735
const noteName = notePath.split('/').pop().replace('.md', '');
736736

737-
// Create markdown link
738-
const link = `[${noteName}](${notePath})`;
737+
// Create markdown link (URL-encode the path to handle spaces and special characters)
738+
const encodedPath = notePath.split('/').map(segment => encodeURIComponent(segment)).join('/');
739+
const link = `[${noteName}](${encodedPath})`;
739740

740741
// Insert at cursor position
741742
const textarea = event.target;
@@ -775,7 +776,8 @@ function noteApp() {
775776
event.preventDefault();
776777

777778
// Remove any anchor from the href (e.g., "note.md#section" -> "note.md")
778-
const notePath = href.split('#')[0];
779+
// Also decode URL encoding (e.g., "note%203.md" -> "note 3.md")
780+
const notePath = decodeURIComponent(href.split('#')[0]);
779781

780782
// Skip if it's just an anchor link
781783
if (!notePath) return;
@@ -2424,11 +2426,11 @@ function noteApp() {
24242426
<meta name="viewport" content="width=device-width, initial-scale=1.0">
24252427
<title>${noteName}</title>
24262428
2427-
<!-- Highlight.js for code syntax highlighting -->
2429+
<!-- Highlight.js for code syntax highlighting (v11.9.0) -->
24282430
${highlightTheme ? `<link rel="stylesheet" href="${highlightTheme}">` : '<!-- No highlight.js theme detected -->'}
24292431
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
24302432
2431-
<!-- MathJax for LaTeX math rendering (same config as preview) -->
2433+
<!-- MathJax for LaTeX math rendering (v3.2.2) -->
24322434
<script>
24332435
MathJax = {
24342436
tex: {
@@ -2452,11 +2454,11 @@ function noteApp() {
24522454
}
24532455
};
24542456
</script>
2455-
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
2457+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js"></script>
24562458
2457-
<!-- Mermaid.js for diagrams (if used in note) -->
2459+
<!-- Mermaid.js for diagrams (v10.9.0) -->
24582460
<script type="module">
2459-
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
2461+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.esm.min.mjs';
24602462
const isDark = ${this.getThemeType() === 'dark'};
24612463
mermaid.initialize({
24622464
startOnLoad: false,

frontend/index.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon.svg">
1212
<link rel="apple-touch-icon" href="/static/logo.svg">
1313

14-
<!-- Tailwind CSS from CDN -->
15-
<script src="https://cdn.tailwindcss.com"></script>
14+
<!-- Tailwind CSS from CDN (v3.4.17) -->
15+
<script src="https://cdn.tailwindcss.com/3.4.17"></script>
1616

17-
<!-- Alpine.js -->
18-
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
17+
<!-- Alpine.js (v3.14.1) -->
18+
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.1/dist/cdn.min.js"></script>
1919

20-
<!-- Marked.js for Markdown parsing -->
21-
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
20+
<!-- Marked.js for Markdown parsing (v12.0.2) -->
21+
<script src="https://cdn.jsdelivr.net/npm/marked@12.0.2/marked.min.js"></script>
2222

2323
<!-- MathJax for LaTeX math rendering -->
2424
<script>
@@ -39,9 +39,9 @@
3939
}
4040
};
4141
</script>
42-
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
42+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js"></script>
4343

44-
<!-- Highlight.js for code syntax highlighting -->
44+
<!-- Highlight.js for code syntax highlighting (v11.9.0) -->
4545
<link rel="stylesheet" id="highlight-theme" href="">
4646
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
4747
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/csharp.min.js"></script>
@@ -57,9 +57,9 @@
5757
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/css.min.js"></script>
5858
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/http.min.js"></script>
5959

60-
<!-- Mermaid.js for diagram rendering -->
60+
<!-- Mermaid.js for diagram rendering (v10.9.0) -->
6161
<script type="module">
62-
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
62+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.esm.min.mjs';
6363
// Note: Mermaid is initialized dynamically by app.js renderMermaid() based on current theme
6464
window.mermaid = mermaid;
6565
</script>

0 commit comments

Comments
 (0)