markdown-text-editor 0.0.21-beta.2 → 0.0.21-beta.3

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 CHANGED
@@ -1,98 +1,142 @@
1
- # MarkdownEditor Plugin Documentation
1
+ ## MarkdownEditor Plugin Documentation
2
2
 
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.
3
+ Welcome to the documentation for the **MarkdownEditor Plugin** an **open source project** offering the **best, simple, embeddable JavaScript Markdown editor plugin or library**. This powerful tool provides **real-time preview**, **syntax highlighting**, and **easy integration** into your projects. Whether you’re building a blog, note-taking app, or any content-rich website, this plugin delivers a robust and customizable markdown editing experience.
4
+
5
+ ---
4
6
 
5
7
  ## Table of Contents
8
+
9
+ - [Overview](#overview)
6
10
  - [Installation](#installation)
7
11
  - [Usage](#usage)
8
12
  - [Configuration Options](#configuration-options)
9
- - [Toolbar Options](#toolbar-options)
10
- - [Methods](#methods)
11
- - [Example Usage](#example-usage)
13
+ - [Toolbar Customization](#toolbar-customization)
14
+ - [Example Implementations](#example-implementations)
15
+ - [Contribution Guidelines](#contribute)
12
16
  - [License](#license)
13
17
 
14
- ## Installation
18
+ ---
15
19
 
16
- To install the plugin in your project, you can include the plugin JavaScript file and its associated styles.
20
+ ## Overview
17
21
 
18
- 1. **Install via NPM** (for bundling tools like Webpack):
19
- ```
20
- npm install markdown-text-editor
21
- ```
22
+ The MarkdownEditor Plugin is designed to be the **best, simple, and embeddable JavaScript markdown editor plugin** available. It is an open source project that boasts:
22
23
 
23
- ## Usage
24
+ - **Real-time Preview:** See your markdown rendered instantly as you type.
25
+ - **Syntax Highlighting:** Enhanced readability with clear code and markdown formatting.
26
+ - **Easy Integration:** Seamlessly integrate into any web project with minimal setup.
27
+ - **Customizable Toolbar:** Dynamically configure and reorder toolbar options like **bold**, **italic**, and more.
28
+
29
+ Built with **Tailwind CSS** for modern styling, this plugin is perfect for developers seeking a lightweight yet feature-rich markdown editor.
30
+
31
+ ---
32
+
33
+ ## Installation
24
34
 
35
+ Integrating the MarkdownEditor Plugin into your project is straightforward. You can install it using NPM, import the JavaScript file directly, or use a CDN for rapid deployment.
25
36
 
26
- Import the `MarkdownEditor` class from markdown-text-editor:
37
+ ### Install via NPM
27
38
 
39
+ For projects utilizing bundling tools like Webpack, run:
28
40
 
41
+ ```bash
42
+ npm install markdown-text-editor
29
43
  ```
44
+
45
+ ---
46
+
47
+ ## Usage
48
+
49
+ After installation, import the `MarkdownEditor` class from the package:
50
+
51
+ ```javascript
30
52
  import MarkdownEditor from "markdown-text-editor";
31
53
  ```
32
54
 
33
- ## Basic Example:
55
+ ### Basic Initialization
34
56
 
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.
57
+ To get started, include a `<textarea>` element in your HTML and initialize the editor by targeting its container:
58
+
59
+ #### HTML
36
60
 
37
- ### HTML:
38
61
  ```html
39
62
  <textarea class="editor-container"></textarea>
40
63
  ```
41
64
 
42
- ### CSS Setup
65
+ #### JavaScript
66
+
67
+ ```javascript
68
+ const editor = new MarkdownEditor('.editor-container', {
69
+ placeholder: 'Write your markdown...',
70
+ toolbar: ['preview', 'bold', 'italic'], // Customize toolbar options as needed
71
+ });
72
+ ```
73
+
74
+ ---
75
+
76
+ ## CSS Setup
43
77
 
44
- #### Using TailwindCSS
78
+ ### Using TailwindCSS
45
79
 
46
- If you are using **TailwindCSS**, add the following configuration to your `tailwind.config.js` file:
80
+ If you’re leveraging **TailwindCSS**, add the following configuration to your `tailwind.config.js`:
47
81
 
48
82
  ```javascript
49
83
  // tailwind.config.js
50
84
  module.exports = {
51
85
  content: [
52
- // './src/**/*.{html,js}',
53
86
  'node_modules/markdown-text-editor/**/*.js',
54
- ]
55
- }
87
+ // Add your project paths here
88
+ ],
89
+ };
56
90
  ```
57
91
 
58
- #### Without TailwindCSS
59
- If you are not using TailwindCSS, you can directly import the CSS file into your project:
92
+ ### Without TailwindCSS
93
+
94
+ For projects not using TailwindCSS, simply import the CSS file directly:
60
95
 
61
96
  ```javascript
62
97
  import 'markdown-text-editor/dist/markdown-text-editor.css';
63
98
  ```
64
99
 
65
- #### Using CDN
66
- For projects using a CDN, you can include the following links:
100
+ ### Using a CDN
67
101
 
68
- **JavaScript:**
69
- ```javascript
102
+ Alternatively, include the following CDN links in your HTML:
103
+
104
+ #### JavaScript:
105
+
106
+ ```html
70
107
  <script src="https://cdn.jsdelivr.net/npm/markdown-text-editor/dist/markdown-text-editor.js"></script>
71
108
  ```
72
109
 
73
- **CSS:**
74
- ```javascript
110
+ #### CSS:
111
+
112
+ ```html
75
113
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markdown-text-editor/dist/markdown-text-editor.min.css">
76
114
  ```
77
115
 
116
+ ---
78
117
 
79
- #### Using a bundler e.g. Webpack:
80
- ```javascript
81
- import MarkdownEditor from 'markdown-text-editor';
118
+ ## Configuration Options
82
119
 
83
- const editor = new MarkdownEditor('.editor-container', {
84
- placeholder: 'Write your markdown...',
85
- toolbar: ['preview', 'bold', 'italic'], // Define the tools you want in the toolbar
86
- });
87
- ```
120
+ Customize your Markdown editor by passing an `options` object during initialization. Below are some key configuration options:
121
+
122
+ | Option | Type | Default | Description |
123
+ |---------------|----------|------------------------------|-----------------------------------------------------------|
124
+ | `placeholder` | `string` | `'Write your markdown...'` | Sets the placeholder text for the textarea. |
125
+ | `toolbar` | `array` | `['bold', 'italic', 'strikethrough']` | Determines which tools appear in the toolbar and their order. |
88
126
 
89
- This will create a markdown editor with a toolbar at the top and a preview area below the text input.
127
+ ---
90
128
 
91
- ### Dynamic Toolbar:
129
+ ## Toolbar Customization
92
130
 
93
- You can specify which formatting options you want in the toolbar. The plugin supports different tools that can be reordered.
131
+ Tailor the toolbar to suit your needs by choosing which formatting options to include. The MarkdownEditor Plugin supports several tools, including:
132
+
133
+ - **`bold`**: Enables bold text formatting.
134
+ - **`italic`**: Enables italic text formatting.
135
+ - **`strikethrough`**: Allows text to be struck through.
136
+ - **`preview`**: Toggles the real-time markdown preview.
137
+
138
+ **Example:**
94
139
 
95
- **For example:**
96
140
  ```javascript
97
141
  const editor = new MarkdownEditor('.editor-container', {
98
142
  placeholder: 'Start writing...',
@@ -100,82 +144,66 @@ const editor = new MarkdownEditor('.editor-container', {
100
144
  });
101
145
  ```
102
146
 
103
- ## Configuration Options
147
+ ---
104
148
 
105
- You can customize the Markdown editor by passing an `options` object when initializing it.
149
+ ## Example Implementations
106
150
 
107
- | Option | Type | Default | Description |
108
- |-------------|----------|----------------------------|-----------------------------------------------------|
109
- | `placeholder` | `string` | `'Write your markdown...'` | The placeholder text for the textarea. |
110
- | `toolbar` | `array` | `['bold', 'italic', 'strikethrough']` | The tools to display in the toolbar and their order. |
151
+ ### Full HTML Example
111
152
 
112
- ## Toolbar Options
113
-
114
- The toolbar can be customized to include the following options (you can add more tools as needed):
115
-
116
- - `bold`: Adds a bold button to the toolbar.
117
- - `italic`: Adds an italic button to the toolbar.
118
-
119
- Example:
120
-
121
- ```javascript
122
- const editor = new MarkdownEditor('.editor-container', {
123
- placeholder: 'Your markdown here...',
124
- toolbar: ['preview', 'italic', 'bold'], // Shows italic first, then bold
125
- });
126
- ```
127
-
128
- ## Example Usage
129
-
130
- ### Full Example:
153
+ Below is a complete HTML example demonstrating how to integrate the MarkdownEditor Plugin into your project:
131
154
 
132
155
  ```html
133
156
  <!DOCTYPE html>
134
157
  <html lang="en">
135
158
  <head>
136
- <meta charset="UTF-8">
137
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
138
- <title>Markdown Editor Example</title>
139
- <link rel="stylesheet" href="dist/markdown-editor-plugin.css">
159
+ <meta charset="UTF-8">
160
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
161
+ <title>Markdown Editor Example</title>
162
+ <link rel="stylesheet" href="dist/markdown-editor-plugin.css">
140
163
  </head>
141
164
  <body>
142
- <textarea class="editor"></textarea>
143
-
144
- <script src="dist/markdown-editor-plugin.js"></script>
145
- <script>
146
- const editor = new MarkdownEditor('.editor-container', {
147
- placeholder: 'Type some markdown...',
148
- toolbar: ['preview', 'bold', 'italic'] // Toolbar order: bold first, then italic
149
- });
150
- </script>
165
+ <textarea class="editor-container"></textarea>
166
+
167
+ <script src="dist/markdown-editor-plugin.js"></script>
168
+ <script>
169
+ const editor = new MarkdownEditor('.editor-container', {
170
+ placeholder: 'Type your markdown...',
171
+ toolbar: ['preview', 'bold', 'italic']
172
+ });
173
+ </script>
151
174
  </body>
152
175
  </html>
153
176
  ```
154
177
 
155
- ### Webpack Example:
178
+ ### Webpack Integration Example
156
179
 
157
- To use the plugin with Webpack, import the plugin and initialize it as shown below:
180
+ For projects using Webpack, import and initialize the editor as follows:
158
181
 
159
182
  ```javascript
160
183
  import MarkdownEditor from 'markdown-text-editor';
161
184
 
162
185
  const editor = new MarkdownEditor('.editor-container', {
163
186
  placeholder: 'Write markdown...',
164
- toolbar: ['preview', 'bold', 'italic'], // Custom toolbar options
187
+ toolbar: ['preview', 'bold', 'italic'],
165
188
  });
166
189
  ```
167
190
 
168
- ### Customizing Styles with Tailwind:
191
+ ### Customizing Styles with TailwindCSS
192
+
193
+ Customize the appearance of the editor using Tailwind utility classes. The plugin’s default styling can be easily overridden in your custom Tailwind configuration.
194
+
195
+ ---
196
+
197
+ ## Contribute
169
198
 
170
- You can modify the appearance of the editor and toolbar using Tailwind utility classes. For example:
199
+ Contributions to this **open source project** are highly encouraged! If you have bug fixes, feature enhancements, or new ideas, please consider opening an issue or submitting a pull request. Your help will ensure that this **best, simple, embeddable JavaScript markdown editor plugin** continues to evolve and serve the community with **real-time preview** and **syntax highlighting** capabilities.
171
200
 
172
- - The toolbar and editor area are styled with Tailwind by default.
173
- - You can override these classes in your custom Tailwind config to suit your design.
201
+ ---
174
202
 
175
- ## Contribute to the Project
203
+ ## License
176
204
 
177
- If you're interested in improving this editor, I welcome contributions! Feel free to open issues or submit pull requests with bug fixes, features, or enhancements. Your contributions will help keep the project active and thriving.
205
+ This project is released under the [MIT License](LICENSE).
178
206
 
179
- Thank you for your support and consideration. Let’s continue to improve Markdown editing together!
207
+ ---
180
208
 
181
- ## A Product of Nezanuha
209
+ Thank you for choosing the MarkdownEditor Plugin – your reliable, feature-rich solution for seamless markdown editing and content creation with **easy integration**. Happy coding!