mdwysiwyg 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FerK (Fernando Manuel Kiernan)
4
+ https://github.com/ferkiernan
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ <div align="center">
2
+
3
+ # mdwysiwyg
4
+
5
+ **A free, open-source, fully customizable Markdown WYSIWYG editor for React.**
6
+
7
+ Dual-view editing (rich text ⇄ raw Markdown), GFM support, syntax-highlighted code blocks,
8
+ a visual table-size picker, read-only mode, resizable UI, and CSS-based theming — in one
9
+ dependency-light component.
10
+
11
+ [![npm version](https://img.shields.io/npm/v/mdwysiwyg.svg)](https://www.npmjs.com/package/mdwysiwyg)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
13
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue.svg)](https://www.typescriptlang.org/)
14
+
15
+ [**Live Demo**](https://ferkiernan.github.io/mdwysiwyg/) · [Documentation](./src/components/MarkdownEditor/README.md) · [Report a Bug](https://github.com/ferkiernan/mdwysiwyg/issues)
16
+
17
+ </div>
18
+
19
+ ---
20
+
21
+ ## Why mdwysiwyg?
22
+
23
+ Most React Markdown editors force a choice: either a heavy, opinionated WYSIWYG editor you can't
24
+ theme, or a raw textarea with a separate preview pane. **mdwysiwyg gives you both views of the
25
+ same document, always in sync, with Markdown as the single source of truth** — and it's free for
26
+ personal and commercial use under the MIT license.
27
+
28
+ - 🆓 **100% free, MIT-licensed** — use it in personal projects, open source, or commercial
29
+ products, no strings attached.
30
+ - 🔄 **True dual-view editing** — a rich-text (WYSIWYG) view and a raw Markdown view of the
31
+ *same* document. Edit either one; both stay perfectly in sync, byte-for-byte, even with
32
+ non-canonical formatting.
33
+ - 🎨 **Fully themeable, no wrapper needed** — every toolbar color, gradient, font, and the
34
+ content area background are CSS Custom Properties. Restyle it with plain CSS; no prop
35
+ explosion, no `theme={{...}}` object to learn.
36
+ - 👁️ **Read-only viewer mode** — flip one prop (`onlyView`) to turn the exact same component
37
+ into a clean, distraction-free document viewer.
38
+ - 📏 **Native resizing** — drag the bottom-right corner like a `<textarea>`, on by default,
39
+ one prop to disable.
40
+ - 🖍️ **Syntax-highlighted code blocks** — JSON, SQL, TypeScript, JavaScript, Java out of the
41
+ box, with graceful fallback for any other language.
42
+ - 📊 **Visual table picker** — a hover-to-size 10×10 grid, just like Excel/Google Sheets/Notion,
43
+ instead of typing row/column counts into a form.
44
+ - 🧩 **GitHub Flavored Markdown** — tables, task lists, strikethrough, and more, parsed and
45
+ serialized through the same battle-tested `unified`/`remark`/`rehype` ecosystem used across
46
+ the JS Markdown world.
47
+ - 🛡️ **Safe by default** — embedded HTML is sanitized automatically (XSS-safe), with an
48
+ explicit opt-out for trusted content.
49
+ - 📦 **Tiny, honest dependency footprint** — every dependency is justified and documented; no
50
+ kitchen-sink bundle. Ships as ESM + CJS + TypeScript declarations.
51
+ - ⌨️ **Accessible** — semantic HTML, ARIA labels/states on every toolbar control, full keyboard
52
+ support on custom pickers.
53
+
54
+ ## Installation
55
+
56
+ Install it as a dependency in any React 18+ project with your package manager of choice:
57
+
58
+ ```bash
59
+ npm install mdwysiwyg
60
+ # or
61
+ pnpm add mdwysiwyg
62
+ # or
63
+ yarn add mdwysiwyg
64
+ ```
65
+
66
+ `react` and `react-dom` are peer dependencies — the package doesn't ship its own copy of React,
67
+ it uses whatever version your project already has (18 or newer).
68
+
69
+ ```tsx
70
+ import { MarkdownEditor } from "mdwysiwyg";
71
+ import "mdwysiwyg/styles.css";
72
+
73
+ export default function App() {
74
+ return (
75
+ <MarkdownEditor
76
+ initialContent="# Hello world\n\nStart typing **here**."
77
+ onChange={(markdown) => console.log(markdown)}
78
+ />
79
+ );
80
+ }
81
+ ```
82
+
83
+ That's it — no configuration required. Full API reference, all props, theming variables, and
84
+ usage examples live in the [component documentation](./src/components/MarkdownEditor/README.md).
85
+
86
+ ### Cloning the repository instead
87
+
88
+ If you want to contribute, run the test suite, or try the demo playground locally instead of
89
+ just consuming the published package:
90
+
91
+ ```bash
92
+ git clone https://github.com/ferkiernan/mdwysiwyg.git
93
+ cd mdwysiwyg
94
+ npm install
95
+ npm run dev # opens the demo playground at http://localhost:5173
96
+ npm test # runs the test suite
97
+ npm run build # builds the distributable package into dist/
98
+ ```
99
+
100
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full development guide.
101
+
102
+ ## Live Demo
103
+
104
+ Try it in your browser, no install required: **[ferkiernan.github.io/mdwysiwyg](https://ferkiernan.github.io/mdwysiwyg/)**
105
+
106
+ ## What's inside
107
+
108
+ | Capability | Details |
109
+ | --- | --- |
110
+ | Formatting | Paragraphs, headings (H1–H6), bold, italic, strikethrough, blockquote |
111
+ | Lists | Ordered, unordered, nested, task lists (checklists) |
112
+ | Insert | Images (by URL), links (URL-only dialog when text is already selected, auto `http://` prefix), tables (visual size picker), horizontal rules, embedded HTML |
113
+ | Links | Click an existing link to open a quick popover: go to URL, copy URL, or edit/remove it inline |
114
+ | Code | Fenced code blocks with a language picker (JSON/SQL/TypeScript/JavaScript/Java/custom) and syntax highlighting |
115
+ | Export | Copy as Markdown or as HTML, one click |
116
+ | Modes | Full editor (default) or read-only viewer (`onlyView`) |
117
+ | Sizing | Fixed (`width`/`height` props) or user-resizable (`resizable`, default on) |
118
+ | Theming | CSS Custom Properties for toolbar colors/gradient/font and content-area background (solid color, gradient, or image) |
119
+
120
+ ## Tech under the hood
121
+
122
+ Built on [Tiptap](https://tiptap.dev/) (ProseMirror) for the rich-text engine and the
123
+ [unified](https://unifiedjs.com/) / [remark](https://github.com/remarkjs/remark) /
124
+ [rehype](https://github.com/rehypejs/rehype) ecosystem for GFM parsing, HTML export, and
125
+ sanitization — the same tools powering much of the modern Markdown tooling in JavaScript.
126
+ TypeScript strict, tested with Vitest + React Testing Library.
127
+
128
+ ## Project status & specs
129
+
130
+ This project is developed spec-first: every feature has a written specification, implementation
131
+ plan, and task breakdown under [`specs/`](./specs/) before being built. See
132
+ [`specs/`](./specs/) for the full history of what's implemented and why.
133
+
134
+ ## Contributing
135
+
136
+ Issues and pull requests are welcome. Please open an issue first for significant changes so we
137
+ can discuss the approach.
138
+
139
+ ## License
140
+
141
+ [MIT](./LICENSE) © [FerK](https://github.com/ferkiernan) — free for personal and commercial use.
142
+ If you build something with it, a mention/credit is appreciated but not required beyond keeping
143
+ the license notice intact.