markdown-text-editor 0.0.18-beta.1 → 0.0.20-beta.2
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 +52 -15
- package/dist/index.js.map +1 -1
- package/dist/markdown-text-editor.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/index.js +1 -1
- package/src/plugins/markdown/editor.js +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MarkdownEditor Plugin Documentation
|
|
2
2
|
|
|
3
|
-
This document explains how to use the **
|
|
3
|
+
This document explains how to use the **MarkdownEditor Plugin**, a customizable, reusable markdown editor with toolbar functionality that allows options like **bold** and **italic** formatting. Users can dynamically set which tools to display and in what order. The plugin is built with Tailwind CSS for styling and provides easy integration into any project.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
- [Installation](#installation)
|
|
@@ -23,27 +23,64 @@ To install the plugin in your project, you can include the plugin JavaScript fil
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
Import the `
|
|
26
|
+
Import the `MarkdownEditor` class from markdown-text-editor:
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
import
|
|
30
|
+
import MarkdownEditor from "markdown-text-editor";
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## Basic Example:
|
|
34
34
|
|
|
35
35
|
To initialize the Markdown editor, you need to add `textarea` tag in your HTML and initialize the editor by passing the container's ID or class and options.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### HTML:
|
|
38
38
|
```html
|
|
39
39
|
<textarea class="editor-container"></textarea>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### CSS Setup
|
|
43
|
+
|
|
44
|
+
#### Using TailwindCSS
|
|
45
|
+
|
|
46
|
+
If you are using **TailwindCSS**, add the following configuration to your `tailwind.config.js` file:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// tailwind.config.js
|
|
50
|
+
module.exports = {
|
|
51
|
+
content: [
|
|
52
|
+
// './src/**/*.{html,js}',
|
|
53
|
+
'node_modules/markdown-text-editor/**/*.js',
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Without TailwindCSS
|
|
59
|
+
If you are not using TailwindCSS, you can directly import the CSS file into your project:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
import 'markdown-text-editor/dist/markdown-text-editor.css';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Using CDN
|
|
66
|
+
For projects using a CDN, you can include the following links:
|
|
67
|
+
|
|
68
|
+
**JavaScript:**
|
|
69
|
+
```javascript
|
|
70
|
+
<script src="https://cdn.jsdelivr.net/npm/markdown-text-editor/dist/markdown-text-editor.js"></script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**CSS:**
|
|
74
|
+
```javascript
|
|
75
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markdown-text-editor/dist/markdown-text-editor.min.css">
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
#### Using a bundler e.g. Webpack:
|
|
43
80
|
```javascript
|
|
44
|
-
import
|
|
81
|
+
import MarkdownEditor from 'markdown-text-editor';
|
|
45
82
|
|
|
46
|
-
const editor = new
|
|
83
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
47
84
|
placeholder: 'Write your markdown...',
|
|
48
85
|
toolbar: ['preview', 'bold', 'italic'], // Define the tools you want in the toolbar
|
|
49
86
|
});
|
|
@@ -55,9 +92,9 @@ This will create a markdown editor with a toolbar at the top and a preview area
|
|
|
55
92
|
|
|
56
93
|
You can specify which formatting options you want in the toolbar. The plugin supports different tools that can be reordered.
|
|
57
94
|
|
|
58
|
-
For example
|
|
95
|
+
**For example:**
|
|
59
96
|
```javascript
|
|
60
|
-
const editor = new
|
|
97
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
61
98
|
placeholder: 'Start writing...',
|
|
62
99
|
toolbar: ['bold', 'italic', 'strikethrough', 'preview'],
|
|
63
100
|
});
|
|
@@ -82,7 +119,7 @@ The toolbar can be customized to include the following options (you can add more
|
|
|
82
119
|
Example:
|
|
83
120
|
|
|
84
121
|
```javascript
|
|
85
|
-
const editor = new
|
|
122
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
86
123
|
placeholder: 'Your markdown here...',
|
|
87
124
|
toolbar: ['preview', 'italic', 'bold'], // Shows italic first, then bold
|
|
88
125
|
});
|
|
@@ -106,7 +143,7 @@ const editor = new markdownEditor('.editor-container', {
|
|
|
106
143
|
|
|
107
144
|
<script src="dist/markdown-editor-plugin.js"></script>
|
|
108
145
|
<script>
|
|
109
|
-
const editor = new
|
|
146
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
110
147
|
placeholder: 'Type some markdown...',
|
|
111
148
|
toolbar: ['preview', 'bold', 'italic'] // Toolbar order: bold first, then italic
|
|
112
149
|
});
|
|
@@ -120,9 +157,9 @@ const editor = new markdownEditor('.editor-container', {
|
|
|
120
157
|
To use the plugin with Webpack, import the plugin and initialize it as shown below:
|
|
121
158
|
|
|
122
159
|
```javascript
|
|
123
|
-
import
|
|
160
|
+
import MarkdownEditor from 'markdown-text-editor';
|
|
124
161
|
|
|
125
|
-
const editor = new
|
|
162
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
126
163
|
placeholder: 'Write markdown...',
|
|
127
164
|
toolbar: ['preview', 'bold', 'italic'], // Custom toolbar options
|
|
128
165
|
});
|