overtype 1.2.2 → 1.2.4

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,6 +1,16 @@
1
1
  # OverType
2
2
 
3
- A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~79KB minified with all features.
3
+ A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay technique. Includes optional toolbar. ~84KB minified with all features.
4
+
5
+ ## Live Examples
6
+
7
+ 🎮 **Try it out**: [Interactive demos on overtype.dev](https://overtype.dev)
8
+ - [Basic Editor](https://overtype.dev/#basic-editor)
9
+ - [With Toolbar](https://overtype.dev/#toolbar)
10
+ - [Multiple Instances](https://overtype.dev/#multiple-instances)
11
+ - [View Modes](https://overtype.dev/#view-modes)
12
+ - [Custom Themes](https://overtype.dev/#custom-themes)
13
+ - [All Markdown Features](https://overtype.dev/#markdown-features)
4
14
 
5
15
  ## Features
6
16
 
@@ -9,9 +19,10 @@ A lightweight markdown editor library with perfect WYSIWYG alignment using an in
9
19
  - ⌨️ **Keyboard shortcuts** - Common markdown shortcuts (Cmd/Ctrl+B for bold, etc.)
10
20
  - 📱 **Mobile optimized** - Responsive design with mobile-specific styles
11
21
  - 🔄 **DOM persistence aware** - Recovers from existing DOM (perfect for HyperClay and similar platforms)
12
- - 🚀 **Lightweight** - ~79KB minified
22
+ - 🚀 **Lightweight** - ~84KB minified
13
23
  - 🎯 **Optional toolbar** - Clean, minimal toolbar with all essential formatting
14
24
  - ✨ **Smart shortcuts** - Keyboard shortcuts with selection preservation
25
+ - 📝 **Smart list continuation** - GitHub-style automatic list continuation on Enter
15
26
  - 🔧 **Framework agnostic** - Works with React, Vue, vanilla JS, and more
16
27
 
17
28
  ## How it works
@@ -24,7 +35,7 @@ We overlap an invisible textarea on top of styled output, giving the illusion of
24
35
 
25
36
  | Feature | OverType | HyperMD | Milkdown | TUI Editor | EasyMDE |
26
37
  |---------|----------|---------|----------|------------|---------|
27
- | **Size** | ~79KB | 364.02 KB | 344.51 KB | 560.99 KB | 323.69 KB |
38
+ | **Size** | ~84KB | 364.02 KB | 344.51 KB | 560.99 KB | 323.69 KB |
28
39
  | **Dependencies** | Bundled | CodeMirror | ProseMirror + plugins | Multiple libs | CodeMirror |
29
40
  | **Setup** | Single file | Complex config | Build step required | Complex config | Moderate |
30
41
  | **Approach** | Invisible textarea | ContentEditable | ContentEditable | ContentEditable | CodeMirror |
@@ -211,20 +222,26 @@ const [editor] = new OverType('#editor', {
211
222
  const markdown = editor.getValue();
212
223
  // Returns: "# Title\n\n**Bold** text with [links](https://example.com)"
213
224
 
214
- // Get rendered HTML for display
225
+ // Get rendered HTML with syntax markers (for debugging/inspection)
215
226
  const html = editor.getRenderedHTML();
216
- // Returns basic HTML with markdown elements
227
+ // Returns HTML with <span class="syntax-marker"> elements visible
217
228
 
218
- // Get HTML with post-processing (consolidated lists/code blocks)
219
- const processedHTML = editor.getRenderedHTML(true);
220
- // Returns HTML optimized for preview mode
229
+ // Get clean HTML for export (no OverType-specific markup)
230
+ const cleanHTML = editor.getRenderedHTML({ cleanHTML: true });
231
+ // Returns clean HTML suitable for saving/exporting
221
232
 
222
- // Get the current preview element's HTML
233
+ // Convenience method for clean HTML
234
+ const exportHTML = editor.getCleanHTML();
235
+ // Same as getRenderedHTML({ cleanHTML: true })
236
+
237
+ // Get the current preview element's HTML (actual DOM content)
223
238
  const previewHTML = editor.getPreviewHTML();
224
239
  // Returns exactly what's shown in the editor's preview layer
225
240
 
226
- // Example: Create external preview
227
- document.getElementById('external-preview').innerHTML = editor.getRenderedHTML(true);
241
+ // Example: Export clean HTML to server
242
+ const htmlToSave = editor.getCleanHTML(); // No syntax markers
243
+ // Example: Clone exact preview appearance
244
+ document.getElementById('clone').innerHTML = editor.getPreviewHTML();
228
245
  ```
229
246
 
230
247
  ### Stats Bar
@@ -345,6 +362,9 @@ new OverType(target, options)
345
362
  // Toolbar
346
363
  toolbar: false, // Enable/disable toolbar with formatting buttons
347
364
 
365
+ // Smart lists
366
+ smartLists: true, // Enable GitHub-style list continuation on Enter
367
+
348
368
  // Stats bar
349
369
  showStats: false, // Enable/disable stats bar
350
370
  statsFormatter: (stats) => { // Custom stats format
@@ -367,11 +387,12 @@ editor.getValue()
367
387
  editor.setValue(markdown)
368
388
 
369
389
  // Get rendered HTML of the current content
370
- editor.getRenderedHTML() // Basic HTML rendering
371
- editor.getRenderedHTML(true) // With post-processing (consolidated lists/code blocks)
390
+ editor.getRenderedHTML() // With syntax markers (for debugging)
391
+ editor.getRenderedHTML({ cleanHTML: true }) // Clean HTML without OverType markup
392
+ editor.getCleanHTML() // Alias for getRenderedHTML({ cleanHTML: true })
372
393
 
373
394
  // Get the current preview element's HTML
374
- editor.getPreviewHTML() // Returns exactly what's displayed in the preview
395
+ editor.getPreviewHTML() // Actual DOM content from preview layer
375
396
 
376
397
  // Change theme
377
398
  editor.setTheme('cave') // Built-in theme name
@@ -547,6 +568,7 @@ Special thanks to:
547
568
  - [kbhomes](https://github.com/kbhomes) - Fixed text selection desynchronization during overscroll ([#17](https://github.com/panphora/overtype/pull/17))
548
569
  - [merlinz01](https://github.com/merlinz01) - Initial TypeScript definitions implementation ([#20](https://github.com/panphora/overtype/pull/20))
549
570
  - [Max Bernstein](https://github.com/tekknolagi) - Fixed typo in website ([#11](https://github.com/panphora/overtype/pull/11))
571
+ - [davidlazar](https://github.com/davidlazar) - Suggested view mode feature for toggling overlay and preview modes ([#24](https://github.com/panphora/overtype/issues/24))
550
572
 
551
573
  ## License
552
574
 
@@ -561,7 +583,7 @@ MIT
561
583
  - **Pluggable parser system** - Support for any programming language or syntax
562
584
  - **Parser registry** - Automatic language detection by file extension or MIME type
563
585
  - **Cleaner separation** - Extracted the overlay technique without markdown-specific features
564
- - **Smaller footprint** - ~79KB minified (vs OverType's ~78KB)
586
+ - **Smaller footprint** - ~84KB minified (vs OverType's ~78KB)
565
587
 
566
588
  Key components extracted from OverType to Synesthesia:
567
589
  - The transparent textarea overlay technique for perfect WYSIWYG alignment
@@ -576,3 +598,7 @@ If you need a markdown editor with toolbar and formatting features, use OverType
576
598
 
577
599
  Contributions are welcome! Please feel free to submit a Pull Request.
578
600
 
601
+ ---
602
+
603
+ Ready for another radical idea?
604
+ [Let's remove every layer of the web application stack.](https://hyperclay.com)