Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"version": 1,
"builtAt": "2026-03-09T22:32:28.513Z",
"documents": [
{
"relativePath": "README.md",
"absolutePath": "/home/frederic/Projects/java/MarkNote/README.md",
"title": "README",
"authors": [],
"tags": [],
"raw": {}
},
{
"relativePath": "src/docs/git-support-complexity.md",
"absolutePath": "/home/frederic/Projects/java/MarkNote/src/docs/git-support-complexity.md",
"title": "git-support-complexity",
"authors": [],
"tags": [],
"raw": {}
},
{
"relativePath": "src/docs/packaging.md",
"absolutePath": "/home/frederic/Projects/java/MarkNote/src/docs/packaging.md",
"title": "packaging",
"authors": [],
"tags": [],
"raw": {}
},
{
"relativePath": "src/docs/user-guide-en.md",
"absolutePath": "/home/frederic/Projects/java/MarkNote/src/docs/user-guide-en.md",
"title": "MarkNote User Guide",
"authors": [
"Frédéric Delorme"
],
"tags": [
"marknote",
"markdown",
"user-guide",
"documentation"
],
"summary": "Welcome to MarkNote, a lightweight and modern Markdown editor built with JavaFX. This guide will help you get started and make the most of MarkNote's features.",
"description": "Official user guide for MarkNote, a lightweight Markdown editor built with JavaFX.",
"raw": {
"title": "MarkNote User Guide",
"date": "2026-02-25T00:00:00.000Z",
"version": "0.1.1",
"author": "Frédéric Delorme",
"description": "Official user guide for MarkNote, a lightweight Markdown editor built with JavaFX.",
"summary": "Welcome to MarkNote, a lightweight and modern Markdown editor built with JavaFX. This guide will help you get started and make the most of MarkNote's features.",
"tags": [
"marknote",
"markdown",
"user-guide",
"documentation"
],
"lang": "en",
"status": "draft"
}
},
{
"relativePath": "TODO.md",
"absolutePath": "/home/frederic/Projects/java/MarkNote/TODO.md",
"title": "TODO",
"authors": [],
"tags": [],
"raw": {}
}
]
}
271 changes: 185 additions & 86 deletions src/main/java/ui/PreviewPanel.java

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion src/main/resources/html/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,41 @@
</style>
</head>
<body><div id="mn-frontmatter">{{FRONT_MATTER}}</div><div id="mn-content">{{CONTENT}}</div>
<script>
// Debug: redirect console to Java alerts
(function() {
var originalLog = console.log;
var originalError = console.error;
var originalWarn = console.warn;
console.log = function() {
var msg = Array.prototype.slice.call(arguments).join(' ');
alert('[LOG] ' + msg);
originalLog.apply(console, arguments);
};
console.error = function() {
var msg = Array.prototype.slice.call(arguments).join(' ');
alert('[ERROR] ' + msg);
originalError.apply(console, arguments);
};
console.warn = function() {
var msg = Array.prototype.slice.call(arguments).join(' ');
alert('[WARN] ' + msg);
originalWarn.apply(console, arguments);
};
window.onerror = function(msg, url, line, col, error) {
alert('[UNCAUGHT] ' + msg + ' at ' + url + ':' + line + ':' + col);
return false;
};
})();
</script>
<script src="{{PREVIEW_JS_PATH}}"></script>
<script>
// Initialize preview features
initializePreview('{{MERMAID_THEME}}');
try {
initializePreview('{{MERMAID_THEME}}');
} catch(e) {
alert('[INIT ERROR] ' + e.message + '\n' + e.stack);
}
</script>
</body>
</html>
1,213 changes: 1,213 additions & 0 deletions src/main/resources/js/hljs/highlight.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/main/resources/js/hljs/styles/a11y-dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/main/resources/js/hljs/styles/github-dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/main/resources/js/hljs/styles/github.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/main/resources/js/hljs/styles/stackoverflow-dark.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: StackOverflow Dark
Description: Dark theme as used on stackoverflow.com
Author: stackoverflow.com
Maintainer: @Hirse
Website: https://github.com/StackExchange/Stacks
License: MIT
Updated: 2021-05-15

Updated for @stackoverflow/stacks v0.64.0
Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less
Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less
*/.hljs{color:#fff;background:#1c1b1b}.hljs-subst{color:#fff}.hljs-comment{color:#999}.hljs-attr,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-section,.hljs-selector-tag{color:#88aece}.hljs-attribute{color:#c59bc1}.hljs-name,.hljs-number,.hljs-quote,.hljs-selector-id,.hljs-template-tag,.hljs-type{color:#f08d49}.hljs-selector-class{color:#88aece}.hljs-link,.hljs-regexp,.hljs-selector-attr,.hljs-string,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#b5bd68}.hljs-meta,.hljs-selector-pseudo{color:#88aece}.hljs-built_in,.hljs-literal,.hljs-title{color:#f08d49}.hljs-bullet,.hljs-code{color:#ccc}.hljs-meta .hljs-string{color:#b5bd68}.hljs-deletion{color:#de7176}.hljs-addition{color:#76c490}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}
13 changes: 13 additions & 0 deletions src/main/resources/js/hljs/styles/stackoverflow-light.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: StackOverflow Light
Description: Light theme as used on stackoverflow.com
Author: stackoverflow.com
Maintainer: @Hirse
Website: https://github.com/StackExchange/Stacks
License: MIT
Updated: 2021-05-15

Updated for @stackoverflow/stacks v0.64.0
Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less
Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less
*/.hljs{color:#2f3337;background:#f6f6f6}.hljs-subst{color:#2f3337}.hljs-comment{color:#656e77}.hljs-attr,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-section,.hljs-selector-tag{color:#015692}.hljs-attribute{color:#803378}.hljs-name,.hljs-number,.hljs-quote,.hljs-selector-id,.hljs-template-tag,.hljs-type{color:#b75501}.hljs-selector-class{color:#015692}.hljs-link,.hljs-regexp,.hljs-selector-attr,.hljs-string,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#54790d}.hljs-meta,.hljs-selector-pseudo{color:#015692}.hljs-built_in,.hljs-literal,.hljs-title{color:#b75501}.hljs-bullet,.hljs-code{color:#535a60}.hljs-meta .hljs-string{color:#54790d}.hljs-deletion{color:#c02d2e}.hljs-addition{color:#2f6f44}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions src/main/resources/js/katex/katex.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main/resources/js/katex/katex.min.js

Large diffs are not rendered by default.

2,843 changes: 2,843 additions & 0 deletions src/main/resources/js/mermaid.min.js

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions src/main/resources/js/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* MarkNote Preview JavaScript Module
* Handles syntax highlighting, diagrams, math equations, and copy buttons.
*/

/**
* Initialize all preview features.
* @param {string} mermaidTheme - Mermaid theme ('default' or 'dark')
*/
function initializePreview(mermaidTheme) {
initializeHighlightJs();
initializeMermaid(mermaidTheme);
renderKaTeX();
initializeCopyButtons();
}

/**
* Initialize highlight.js syntax highlighting.
*/
function initializeHighlightJs() {
hljs.highlightAll();
}

/**
* Initialize Mermaid diagrams.
* Transforms <pre><code class="language-mermaid"> blocks into <div class="mermaid">.
* @param {string} theme - Mermaid theme ('default' or 'dark')
*/
function initializeMermaid(theme) {
document.querySelectorAll('pre code.language-mermaid').forEach(function(block) {
var pre = block.parentElement;
var div = document.createElement('div');
div.className = 'mermaid';
div.textContent = block.textContent;
pre.parentNode.replaceChild(div, pre);
});
mermaid.initialize({ startOnLoad: true, theme: theme });
}

/**
* Render KaTeX math expressions.
* Supports block ($$...$$) and inline ($...$) math.
*/
function renderKaTeX() {
function renderMath(el) {
var html = el.innerHTML;
// Block math: $$...$$
html = html.replace(/\$\$([\s\S]+?)\$\$/g, function(m, tex) {
try {
return katex.renderToString(tex.trim(), { displayMode: true, throwOnError: false });
} catch(e) { return m; }
});
// Inline math: $...$ (not preceded by \, not followed by digit)
html = html.replace(/(?<!\\)\$([^\$\n]+?)\$/g, function(m, tex) {
try {
return katex.renderToString(tex.trim(), { displayMode: false, throwOnError: false });
} catch(e) { return m; }
});
el.innerHTML = html;
}
renderMath(document.body);
}

/**
* Initialize copy buttons on code blocks.
*/
function initializeCopyButtons() {
document.querySelectorAll('pre > code').forEach(function(codeEl) {
var pre = codeEl.parentElement;
if (pre.querySelector('.copy-btn')) return;
var btn = document.createElement('button');
btn.className = 'copy-btn';
btn.textContent = 'Copy';
btn.addEventListener('click', function() {
var text = codeEl.textContent;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(function() {
btn.textContent = '\u2713 Copied';
btn.classList.add('copied');
setTimeout(function() { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 1500);
});
} else {
var ta = document.createElement('textarea');
ta.value = text; ta.style.position = 'fixed'; ta.style.opacity = '0';
document.body.appendChild(ta); ta.select();
document.execCommand('copy'); document.body.removeChild(ta);
btn.textContent = '\u2713 Copied';
btn.classList.add('copied');
setTimeout(function() { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 1500);
}
});
pre.appendChild(btn);
});
}