md2wiki 1.0.3 → 1.0.5
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 +29 -122
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,101 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
<br />
|
|
3
|
-
<img src="public/logo.svg" alt="md2wiki logo" width="160" />
|
|
4
|
-
<br />
|
|
5
|
-
<h1>🔄 MD2WIKI</h1>
|
|
6
|
-
<p><strong>Real-Time Markdown to MediaWiki Wikitext Converter</strong></p>
|
|
7
|
-
<p><i>A premium Next.js utility for Wikipedia editors featuring SUL OAuth 2.0 Sandbox publishing and CORS-free repository README importing.</i></p>
|
|
8
|
-
|
|
9
|
-
<br />
|
|
10
|
-
|
|
11
|
-
<div align="center">
|
|
12
|
-
<img src="https://img.shields.io/badge/Stack-Next.js%2015%20%7C%20Tailwind%20v4-emerald?style=for-the-badge" alt="Stack" />
|
|
13
|
-
<img src="https://img.shields.io/badge/License-MIT-blue?style=for-the-badge" alt="License" />
|
|
14
|
-
<img src="https://img.shields.io/badge/Platform-Wikimedia%20Toolforge-violet?style=for-the-badge" alt="Platform" />
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<br />
|
|
18
|
-
<div align="center">
|
|
19
|
-
<img src="assets/preview.png" alt="Showcase Preview" width="600" style="border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);" />
|
|
20
|
-
</div>
|
|
21
|
-
<br />
|
|
22
|
-
</div>
|
|
1
|
+
# md2wiki
|
|
23
2
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## 🧭 Navigation
|
|
3
|
+
A real-time Markdown to MediaWiki Wikitext converter built with Next.js and Tailwind CSS.
|
|
27
4
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* [🚀 Local Quick Start](#-local-quick-start)
|
|
31
|
-
* [🔒 SUL OAuth 2.0 Credentials](#-sul-oauth-20-credentials)
|
|
32
|
-
* [📦 Toolforge Deployment](#-toolforge-deployment)
|
|
33
|
-
* [💻 Command Line Interface (CLI)](#-command-line-interface-cli)
|
|
5
|
+
[](https://discord.gg/cNBReEyvK)
|
|
6
|
+
[](LICENSE)
|
|
34
7
|
|
|
35
8
|
---
|
|
36
9
|
|
|
37
|
-
##
|
|
10
|
+
## About the Project
|
|
38
11
|
|
|
39
|
-
|
|
12
|
+
**md2wiki** is a developer tool designed for Wikipedia editors and contributors. Writing long drafts or documentation offline in Markdown is standard, but publishing them on Wikipedia requires converting them into MediaWiki's native Wikitext markup.
|
|
40
13
|
|
|
41
|
-
|
|
14
|
+
This application provides a real-time web interface that parses Markdown and compiles it into clean, compliant Wikitext instantly.
|
|
15
|
+
|
|
16
|
+

|
|
42
17
|
|
|
43
18
|
---
|
|
44
19
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
<div align="center">
|
|
48
|
-
<table border="0" cellspacing="0" cellpadding="20">
|
|
49
|
-
<tr>
|
|
50
|
-
<td width="300" valign="top" style="border: 1px solid #333; border-radius: 15px; background: rgba(255,255,255,0.02); padding: 15px;">
|
|
51
|
-
<h3>⚡ Real-Time Compiler</h3>
|
|
52
|
-
<p>Instant, client-side translation of Markdown headers, text styling, tables, code blocks, lists, and links without network lag.</p>
|
|
53
|
-
</td>
|
|
54
|
-
<td width="300" valign="top" style="border: 1px solid #333; border-radius: 15px; background: rgba(255,255,255,0.02); padding: 15px;">
|
|
55
|
-
<h3>🛡️ Smart Heading Shift</h3>
|
|
56
|
-
<p>Detects Markdown H1s and auto-shifts headings to avoid duplicate H1 page titles on Wikipedia, conforming strictly to style guidelines.</p>
|
|
57
|
-
</td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<td width="300" valign="top" style="border: 1px solid #333; border-radius: 15px; background: rgba(255,255,255,0.02); padding: 15px;">
|
|
61
|
-
<h3>🔗 Repository Importer</h3>
|
|
62
|
-
<p>Paste any GitHub or GitLab repository link, and our CORS-free proxy endpoint fetches, parses, and translates the README file.</p>
|
|
63
|
-
</td>
|
|
64
|
-
<td width="300" valign="top" style="border: 1px solid #333; border-radius: 15px; background: rgba(255,255,255,0.02); padding: 15px;">
|
|
65
|
-
<h3>📝 Sandbox SUL Publisher</h3>
|
|
66
|
-
<p>Log in securely via Wikimedia SUL OAuth 2.0 and save wikitext directly to <code>User:<Username>/sandbox</code> on any language Wikipedia.</p>
|
|
67
|
-
</td>
|
|
68
|
-
</tr>
|
|
69
|
-
</table>
|
|
70
|
-
</div>
|
|
20
|
+
## Key Features
|
|
71
21
|
|
|
72
|
-
|
|
22
|
+
* **Real-time Translation:** Type or paste Markdown in the left editor and watch the formatted Wikitext compile on the right with zero lag.
|
|
23
|
+
* **Smart Heading Shift:** Auto-shifts Markdown heading levels down by one (e.g., Markdown `#` becomes Wiki `== H2 ==`) to prevent duplicate H1 page titles on Wikipedia.
|
|
24
|
+
* **Repository Importer:** Enter a GitHub or GitLab repository URL, and the tool will fetch and translate the README file automatically.
|
|
25
|
+
* **Sandbox Publishing:** Log in securely via Wikimedia Single User Login (SUL) OAuth 2.0 to save your converted Wikitext directly to your Wikipedia user sandbox page.
|
|
26
|
+
* **State Persistence:** Your progress is automatically cached in the browser's local storage, preventing data loss if you refresh the page or navigate away.
|
|
73
27
|
|
|
74
|
-
|
|
28
|
+
---
|
|
75
29
|
|
|
76
|
-
|
|
30
|
+
## Local Development (Run on Localhost)
|
|
77
31
|
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
git clone https://github.com/your-username/md2wiki.git
|
|
81
|
-
cd md2wiki
|
|
82
|
-
```
|
|
32
|
+
To run the application locally on your machine, follow these steps:
|
|
83
33
|
|
|
84
|
-
###
|
|
34
|
+
### 1. Install Dependencies
|
|
85
35
|
```bash
|
|
86
36
|
npm install
|
|
87
37
|
```
|
|
88
38
|
|
|
89
|
-
###
|
|
90
|
-
|
|
39
|
+
### 2. Configure Environment Variables (Optional)
|
|
40
|
+
If you want to use SUL Sandbox publishing locally, copy `.env.example` or create a `.env` file:
|
|
91
41
|
```env
|
|
92
42
|
WIKIMEDIA_CLIENT_ID=your_oauth_consumer_token
|
|
93
43
|
WIKIMEDIA_CLIENT_SECRET=your_oauth_secret_token
|
|
94
|
-
SESSION_SECRET=
|
|
44
|
+
SESSION_SECRET=your_session_encryption_key
|
|
95
45
|
WIKIMEDIA_REDIRECT_URI=http://localhost:8000/api/auth/callback
|
|
96
46
|
```
|
|
47
|
+
*Note: If no `.env` is configured, the application automatically runs in **Mock SUL Mode** for safe local testing.*
|
|
97
48
|
|
|
98
|
-
###
|
|
49
|
+
### 3. Start the Server
|
|
99
50
|
```bash
|
|
100
51
|
npm run dev
|
|
101
52
|
```
|
|
@@ -103,60 +54,16 @@ Open **[http://localhost:8000](http://localhost:8000)** in your browser.
|
|
|
103
54
|
|
|
104
55
|
---
|
|
105
56
|
|
|
106
|
-
##
|
|
107
|
-
|
|
108
|
-
To enable sandbox publishing, register the tool:
|
|
109
|
-
|
|
110
|
-
1. Log in to [Meta-Wiki](https://meta.wikimedia.org/).
|
|
111
|
-
2. Navigate to [Special:OAuthConsumerRegistration/propose/oauth2](https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose/oauth2).
|
|
112
|
-
3. Set the parameters:
|
|
113
|
-
* **OAuth callback URL**: `https://md2wiki.toolforge.org/api/auth/callback` (or `http://localhost:8000/api/auth/callback` for dev).
|
|
114
|
-
* **Grants**: Select **Basic rights** (`basic`), **Edit existing pages** (`edit`), and **Create, edit, and move pages** (`writepage` / `create`).
|
|
115
|
-
4. Submit and record your **Consumer Token** and **Secret Token**.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## 📦 Toolforge Deployment
|
|
120
|
-
|
|
121
|
-
Wikimedia Toolforge supports hosting Node.js Next.js web applications using Kubernetes.
|
|
122
|
-
|
|
123
|
-
### 1. SSH into Toolforge Bastion
|
|
124
|
-
```bash
|
|
125
|
-
ssh <username>@login.toolforge.org
|
|
126
|
-
become <tool-name>
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 2. Clone and install dependencies
|
|
130
|
-
Ensure files are cloned in your Toolforge home directory `www/js/`:
|
|
131
|
-
```bash
|
|
132
|
-
cd $HOME
|
|
133
|
-
git clone https://github.com/your-username/md2wiki.git www/js
|
|
134
|
-
cd www/js
|
|
135
|
-
npm install
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 3. Create production `.env` file
|
|
139
|
-
Include your Toolforge OAuth credentials, secret, and port details inside `www/js/.env`.
|
|
140
|
-
|
|
141
|
-
### 4. Build and start
|
|
142
|
-
```bash
|
|
143
|
-
npm run build
|
|
144
|
-
toolforge webservice node18 start
|
|
145
|
-
```
|
|
146
|
-
Traffic is automatically routed to `https://<tool-name>.toolforge.org/`.
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## 💻 Command Line Interface (CLI)
|
|
57
|
+
## Command Line Interface (CLI)
|
|
151
58
|
|
|
152
|
-
You can run the translator
|
|
59
|
+
You can also run the translator directly via the command line to convert local files:
|
|
153
60
|
|
|
154
61
|
```bash
|
|
155
62
|
npm run parse -- <path-to-markdown-file>
|
|
156
63
|
```
|
|
157
64
|
|
|
158
|
-
|
|
65
|
+
**Example:**
|
|
159
66
|
```bash
|
|
160
|
-
npm run parse -- draft.md >
|
|
67
|
+
npm run parse -- draft.md > output.wiki
|
|
161
68
|
```
|
|
162
|
-
Smart heading shifts and
|
|
69
|
+
*Smart heading shifts and Wikipedia link conversions are enabled by default on CLI runs.*
|