You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**autoDownloadFontAwesome**: If set to `true`, force downloads Font Awesome (used for icons). If set to `false`, prevents downloading. Defaults to `undefined`, which will intelligently check whether Font Awesome has already been included, then download accordingly.
90
-
-**autofocus**: If set to `true`, autofocuses the editor. Defaults to `false`.
91
-
-**autosave**: *Saves the text that's being written and will load it back in the future. It will forget the text when the form it's contained in is submitted.*
92
-
-**enabled**: If set to `true`, autosave the text. Defaults to `false`.
93
-
-**delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
94
-
-**uniqueId**: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
95
-
-**blockStyles**: Customize how certain buttons that style blocks of text behave.
96
-
-**bold** Can be set to `**` or `__`. Defaults to `**`.
97
-
-**code** Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
98
-
-**italic** Can be set to `*` or `_`. Defaults to `*`.
99
-
-**element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
100
-
-**forceSync**: If set to `true`, force text changes made in SimpleMDE to be immediately stored in original textarea. Defaults to `false`.
101
-
-**hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
102
-
-**indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
103
-
-**initialValue**: If set, will customize the initial value of the editor.
104
-
-**insertTexts**: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: `["[", "](http://)"]`.
105
-
- horizontalRule
106
-
- image
107
-
- link
108
-
- table
109
-
-**lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
110
-
-**parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
111
-
-**allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
112
-
-**strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`.
113
-
-**underscoresBreakWords**: If set to `true`, let underscores be a delimiter for separating words. Defaults to `false`.
114
-
-**placeholder**: Custom placeholder that should be displayed
115
-
-**previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
116
-
-**promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
117
-
-**renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
118
-
-**singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
119
-
-**codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
120
-
-**shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
121
-
-**showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
122
-
-**spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
123
-
-**status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items.
124
-
- Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items.
125
-
-**styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`.
126
-
-**tabSize**: If set, customize the tab size. Defaults to `2`.
127
-
-**toolbar**: If set to `false`, hide the toolbar. Defaults to the [array of icons](#toolbar-icons).
128
-
-**toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`.
129
-
130
-
```JavaScript
131
-
// Most options demonstrate the non-default behavior
132
-
var simplemde =newSimpleMDE({
133
-
autofocus:true,
134
-
autosave: {
135
-
enabled:true,
136
-
uniqueId:"MyUniqueID",
137
-
delay:1000,
138
-
},
139
-
blockStyles: {
140
-
bold:"__",
141
-
italic:"_"
142
-
},
143
-
element:document.getElementById("MyID"),
144
-
forceSync:true,
145
-
hideIcons: ["guide", "heading"],
146
-
indentWithTabs:false,
147
-
initialValue:"Hello world!",
148
-
insertTexts: {
149
-
horizontalRule: ["", "\n\n-----\n\n"],
150
-
image: [""],
151
-
link: ["[", "](http://)"],
152
-
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
153
-
},
154
-
lineWrapping:false,
155
-
parsingConfig: {
156
-
allowAtxHeaderWithoutSpace:true,
157
-
strikethrough:false,
158
-
underscoresBreakWords:true,
159
-
},
160
-
placeholder:"Type here...",
161
-
previewRender:function(plainText) {
162
-
returncustomMarkdownParser(plainText); // Returns HTML from a custom parser
}], // Another optional usage, with a custom status bar item that counts keystrokes
193
-
styleSelectedText:false,
194
-
tabSize:4,
195
-
toolbar:false,
196
-
toolbarTips:false,
197
-
});
198
-
```
199
-
200
-
#### Toolbar icons
201
-
202
-
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. "Name" is the name of the icon, referenced in the JS. "Action" is either a function or a URL to open. "Class" is the class given to the icon. "Tooltip" is the small tooltip that appears via the `title=""` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be "Bold (Ctrl-B)").
203
-
204
-
Additionally, you can add a separator between any icons by adding `"|"` to the toolbar array.
// Customize all information and/or add your own icons
240
-
var simplemde =newSimpleMDE({
241
-
toolbar: [{
242
-
name:"bold",
243
-
action:SimpleMDE.toggleBold,
244
-
className:"fa fa-bold",
245
-
title:"Bold",
246
-
},
247
-
{
248
-
name:"custom",
249
-
action:functioncustomFunction(editor){
250
-
// Add your own code
251
-
},
252
-
className:"fa fa-star",
253
-
title:"Custom Button",
254
-
},
255
-
"|", // Separator
256
-
...
257
-
],
258
-
});
104
+
### install
259
105
```
260
-
261
-
#### Keyboard shortcuts
262
-
263
-
SimpleMDE comes with an array of predefined keyboard shortcuts, but they can be altered with a configuration option. The list of default ones is as follows:
264
-
265
-
Shortcut | Action
266
-
:------- | :-----
267
-
*Cmd-'* | "toggleBlockquote"
268
-
*Cmd-B* | "toggleBold"
269
-
*Cmd-E* | "cleanBlock"
270
-
*Cmd-H* | "toggleHeadingSmaller"
271
-
*Cmd-I* | "toggleItalic"
272
-
*Cmd-K* | "drawLink"
273
-
*Cmd-L* | "toggleUnorderedList"
274
-
*Cmd-P* | "togglePreview"
275
-
*Cmd-Alt-C* | "toggleCodeBlock"
276
-
*Cmd-Alt-I* | "drawImage"
277
-
*Cmd-Alt-L* | "toggleOrderedList"
278
-
*Shift-Cmd-H* | "toggleHeadingBigger"
279
-
*F9* | "toggleSideBySide"
280
-
*F11* | "toggleFullScreen"
281
-
282
-
Here is how you can change a few, while leaving others untouched:
283
-
284
-
```JavaScript
285
-
var simplemde =newSimpleMDE({
286
-
shortcuts: {
287
-
"toggleOrderedList":"Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
288
-
"toggleCodeBlock":null, // unbind Ctrl-Alt-C
289
-
"drawTable":"Cmd-Alt-T"// bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
290
-
}
291
-
});
106
+
$ npm install --save github-markdown-css
292
107
```
293
108
294
-
Shortcuts are automatically converted between platforms. If you define a shortcut as "Cmd-B", on PC that shortcut will be changed to "Ctrl-B". Conversely, a shortcut defined as "Ctrl-B" will become "Cmd-B" for Mac users.
295
-
296
-
The list of actions that can be bound is the same as the list of built-in actions available for [toolbar buttons](#toolbar-icons).
297
-
298
-
#### Height
299
-
300
-
To change the minimum height (before it starts auto-growing):
SimpleMDE began as an improvement of [lepture's Editor project](https://github.com/lepture/editor), but has now taken on an identity of its own. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fontawesome.io).
118
+
## Configuration
319
119
320
-
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by [Marked](https://github.com/chjj/marked) using GFM.
0 commit comments