mrmd-editor 0.3.10 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +3 -2
- package/src/execution.js +8 -3
- package/src/index.js +6 -0
- package/src/runtime.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Maxime Rivest
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mrmd-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Markdown editor with realtime collaboration - the core editor package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mrmd.cjs",
|
|
@@ -57,9 +57,10 @@
|
|
|
57
57
|
"@lezer/highlight": "^1.2.0",
|
|
58
58
|
"@plutojl/lang-julia": "^0.12.1",
|
|
59
59
|
"codemirror": "^6.0.1",
|
|
60
|
+
"codemirror-lang-mermaid": "^0.3.0",
|
|
60
61
|
"codemirror-lang-r": "^0.1.1",
|
|
61
62
|
"katex": "^0.16.27",
|
|
62
|
-
"mrmd-js": "^2.
|
|
63
|
+
"mrmd-js": "^2.1.0",
|
|
63
64
|
"y-codemirror.next": "^0.3.5",
|
|
64
65
|
"y-websocket": "^2.0.0",
|
|
65
66
|
"yaml": "^2.8.2",
|
package/src/execution.js
CHANGED
|
@@ -725,11 +725,16 @@ export class ExecutionManager {
|
|
|
725
725
|
const existingOutput = findOutputBlock(content, currentCell.end);
|
|
726
726
|
|
|
727
727
|
// Determine output type based on language (for rich rendering)
|
|
728
|
-
// HTML and
|
|
728
|
+
// HTML, CSS, and Mermaid get special output types for visual rendering
|
|
729
729
|
// Use runtimeLanguage (base language) for determining output type
|
|
730
730
|
const langLower = runtimeLanguage.toLowerCase();
|
|
731
|
-
const isRichOutput = ['html', 'htm', 'css', 'style', 'stylesheet'].includes(langLower);
|
|
732
|
-
const outputType = isRichOutput ? langLower.replace(/^(htm|style|stylesheet)$/, (m) =>
|
|
731
|
+
const isRichOutput = ['html', 'htm', 'css', 'style', 'stylesheet', 'mermaid'].includes(langLower);
|
|
732
|
+
const outputType = isRichOutput ? langLower.replace(/^(htm|style|stylesheet|mermaid)$/, (m) => {
|
|
733
|
+
if (m === 'htm') return 'html';
|
|
734
|
+
if (m === 'style' || m === 'stylesheet') return 'css';
|
|
735
|
+
if (m === 'mermaid') return 'html'; // Mermaid renders to HTML/SVG
|
|
736
|
+
return m;
|
|
737
|
+
}) : null;
|
|
733
738
|
const outputTag = outputType ? `output:${execId}:${outputType}` : `output:${execId}`;
|
|
734
739
|
|
|
735
740
|
if (existingOutput) {
|
package/src/index.js
CHANGED
|
@@ -51,6 +51,7 @@ import { xml } from '@codemirror/lang-xml';
|
|
|
51
51
|
import { yaml } from '@codemirror/lang-yaml';
|
|
52
52
|
import { r } from 'codemirror-lang-r';
|
|
53
53
|
import { julia } from '@plutojl/lang-julia';
|
|
54
|
+
import { mermaid } from 'codemirror-lang-mermaid';
|
|
54
55
|
import { shell } from '@codemirror/legacy-modes/mode/shell';
|
|
55
56
|
import { powerShell } from '@codemirror/legacy-modes/mode/powershell';
|
|
56
57
|
|
|
@@ -365,6 +366,8 @@ function createJavaScriptRuntime(options = {}) {
|
|
|
365
366
|
'htm': 'html',
|
|
366
367
|
// CSS
|
|
367
368
|
'css': 'css',
|
|
369
|
+
// Mermaid diagrams
|
|
370
|
+
'mermaid': 'mermaid',
|
|
368
371
|
};
|
|
369
372
|
|
|
370
373
|
return {
|
|
@@ -572,6 +575,7 @@ const xmlSupport = xml();
|
|
|
572
575
|
const yamlSupport = yaml();
|
|
573
576
|
const rSupport = r();
|
|
574
577
|
const juliaSupport = julia();
|
|
578
|
+
const mermaidSupport = mermaid();
|
|
575
579
|
const shellLang = StreamLanguage.define(shell);
|
|
576
580
|
const powershellLang = StreamLanguage.define(powerShell);
|
|
577
581
|
|
|
@@ -616,6 +620,8 @@ function codeBlockLanguage(info) {
|
|
|
616
620
|
return shellLang;
|
|
617
621
|
case 'powershell': case 'ps1': case 'pwsh':
|
|
618
622
|
return powershellLang;
|
|
623
|
+
case 'mermaid':
|
|
624
|
+
return mermaidSupport.language;
|
|
619
625
|
default:
|
|
620
626
|
return null;
|
|
621
627
|
}
|