hexagon-editor 0.1.6 → 0.1.7
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/README.md +23 -16
- package/dist/index.js +1287 -3611
- package/dist/renderer.js +3587 -193
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,19 +12,29 @@ Component styles are included automatically when importing the editor or rendere
|
|
|
12
12
|
`hexagon-editor/style.css` export is available only for integrations that need to load
|
|
13
13
|
the complete stylesheet explicitly.
|
|
14
14
|
|
|
15
|
+
```ts
|
|
16
|
+
export default defineNuxtConfig({
|
|
17
|
+
css: ['hexagon-editor/renderer.css'],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default defineNuxtConfig({
|
|
21
|
+
css: ['hexagon-editor/style.css'],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
15
25
|
## Read-only rendering
|
|
16
26
|
|
|
17
27
|
Sites that only display documents can import the standalone renderer without bundling the editor, ProseMirror, CodeMirror, toolbar, or editor styles:
|
|
18
28
|
|
|
19
29
|
```vue
|
|
20
30
|
<script setup lang="ts">
|
|
21
|
-
import {MarkdownRenderer} from 'hexagon-editor/renderer';
|
|
31
|
+
import { MarkdownRenderer } from 'hexagon-editor/renderer';
|
|
22
32
|
|
|
23
|
-
defineProps<{content: string}>();
|
|
33
|
+
defineProps<{ content: string }>();
|
|
24
34
|
</script>
|
|
25
35
|
|
|
26
36
|
<template>
|
|
27
|
-
|
|
37
|
+
<MarkdownRenderer :content="content" />
|
|
28
38
|
</template>
|
|
29
39
|
```
|
|
30
40
|
|
|
@@ -42,11 +52,13 @@ Pass local adapters through `features`; Mermaid can be loaded lazily, and KaTeX
|
|
|
42
52
|
```ts
|
|
43
53
|
import katex from 'katex';
|
|
44
54
|
import 'katex/dist/katex.min.css';
|
|
45
|
-
import type {MarkdownFeatures} from 'hexagon-editor';
|
|
55
|
+
import type { MarkdownFeatures } from 'hexagon-editor';
|
|
46
56
|
|
|
47
57
|
const features: MarkdownFeatures = {
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
math: {
|
|
59
|
+
renderToString: (latex, display) => katex.renderToString(latex, { displayMode: display, throwOnError: true }),
|
|
60
|
+
},
|
|
61
|
+
mermaid: { load: () => import('mermaid').then(({ default: mermaid }) => mermaid) },
|
|
50
62
|
};
|
|
51
63
|
```
|
|
52
64
|
|
|
@@ -60,20 +72,15 @@ Raw Markdown HTML and the contents of `:::html ... :::` are displayed as source
|
|
|
60
72
|
|
|
61
73
|
```vue
|
|
62
74
|
<script setup lang="ts">
|
|
63
|
-
import {ref} from 'vue';
|
|
64
|
-
import {MarkdownEditor} from 'hexagon-editor';
|
|
75
|
+
import { ref } from 'vue';
|
|
76
|
+
import { MarkdownEditor } from 'hexagon-editor';
|
|
65
77
|
|
|
66
|
-
const value = ref('# Document');
|
|
67
|
-
const mode = ref<'wysiwyg' | 'markup' | 'split'>('wysiwyg');
|
|
78
|
+
const value = ref('# Document');
|
|
79
|
+
const mode = ref<'wysiwyg' | 'markup' | 'split'>('wysiwyg');
|
|
68
80
|
</script>
|
|
69
81
|
|
|
70
82
|
<template>
|
|
71
|
-
|
|
72
|
-
v-model="value"
|
|
73
|
-
v-model:mode="mode"
|
|
74
|
-
locale="ru"
|
|
75
|
-
theme="auto"
|
|
76
|
-
/>
|
|
83
|
+
<MarkdownEditor v-model="value" v-model:mode="mode" locale="ru" theme="auto" />
|
|
77
84
|
</template>
|
|
78
85
|
```
|
|
79
86
|
|