mintlify-convert 2.0.0__tar.gz
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.
- mintlify_convert-2.0.0/CHANGELOG.md +94 -0
- mintlify_convert-2.0.0/LICENSE +21 -0
- mintlify_convert-2.0.0/MANIFEST.in +5 -0
- mintlify_convert-2.0.0/PKG-INFO +299 -0
- mintlify_convert-2.0.0/README.md +266 -0
- mintlify_convert-2.0.0/mintlify_convert/__init__.py +20 -0
- mintlify_convert-2.0.0/mintlify_convert/cli.py +170 -0
- mintlify_convert-2.0.0/mintlify_convert/converter.py +1075 -0
- mintlify_convert-2.0.0/mintlify_convert/navigation.py +246 -0
- mintlify_convert-2.0.0/mintlify_convert/utils.py +274 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/PKG-INFO +299 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/SOURCES.txt +29 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/dependency_links.txt +1 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/entry_points.txt +2 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/requires.txt +9 -0
- mintlify_convert-2.0.0/mintlify_convert.egg-info/top_level.txt +1 -0
- mintlify_convert-2.0.0/pyproject.toml +72 -0
- mintlify_convert-2.0.0/setup.cfg +4 -0
- mintlify_convert-2.0.0/tests/__init__.py +1 -0
- mintlify_convert-2.0.0/tests/conftest.py +46 -0
- mintlify_convert-2.0.0/tests/fixtures/expected_output.mdx +56 -0
- mintlify_convert-2.0.0/tests/fixtures/sample.mdx +41 -0
- mintlify_convert-2.0.0/tests/test_cli.py +110 -0
- mintlify_convert-2.0.0/tests/test_converter.py +181 -0
- mintlify_convert-2.0.0/tests/test_docs_json.py +228 -0
- mintlify_convert-2.0.0/tests/test_fix_round.py +571 -0
- mintlify_convert-2.0.0/tests/test_golden.py +32 -0
- mintlify_convert-2.0.0/tests/test_images_security.py +244 -0
- mintlify_convert-2.0.0/tests/test_integration.py +157 -0
- mintlify_convert-2.0.0/tests/test_navigation.py +201 -0
- mintlify_convert-2.0.0/tests/test_spec_converter.py +377 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
No release has been tagged or published yet. The entries below describe the v2.0 work in progress.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Mintlify component output: Warning, Note, Tip, Info and Check callouts, Steps, Tabs, Cards, Accordion (keyword heuristic on H3 titles), Banner (narrow prefix match) and Frame-wrapped images
|
|
14
|
+
- Navigation generation with nested groups from the folder structure; "Getting Started" first, then alphabetical; optional `--sort-pages`
|
|
15
|
+
- `docs.json` generation (`--generate-config`) and legacy `mint.json` generation (`--legacy-mint-json`)
|
|
16
|
+
- Asset handling: images are copied only with `--download-assets` and only from inside the input directory
|
|
17
|
+
- MDX validation with error reporting
|
|
18
|
+
- Command-line interface with branding options for the generated config file
|
|
19
|
+
- Project restructure into a package, test suite with fixtures, examples, CI workflows and pre-commit configuration
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- `--generate-mint-json` is deprecated; it is an alias for `--generate-config --legacy-mint-json`
|
|
23
|
+
- Minimum supported Python version is 3.10
|
|
24
|
+
- Conversion is idempotent, and the output path may not equal or sit inside the input path
|
|
25
|
+
- Input files larger than 1 MiB are rejected with an error
|
|
26
|
+
- Navigation groups are ordered "Getting Started", then "Documentation", then the rest alphabetically
|
|
27
|
+
- Accordions are created only for H3 headings containing troubleshooting, FAQ, frequently asked, advanced, common issues, known issues, error codes, walkthrough, step by step or breakdown, and end at the next heading of any level
|
|
28
|
+
- One numbered list becomes one `<Steps>` block; it continues across blank lines and code fences or indented content between items
|
|
29
|
+
- Step titles are plain text and end at a clause or word boundary at about 80 characters
|
|
30
|
+
- Consecutive language-labelled blocks (three or more included) form one `<Tabs>` group
|
|
31
|
+
- Relative links that resolve outside the input directory are left unchanged
|
|
32
|
+
- Callouts, banners and step lists that start with a code fence are left unconverted; banners and help cards only match at the start of a paragraph
|
|
33
|
+
- Symlinked input files and `file:` image sources are skipped with a warning on stderr; the exit status stays 0
|
|
34
|
+
- `--validate` no longer reports code-block content as unclosed tags
|
|
35
|
+
|
|
36
|
+
### Security
|
|
37
|
+
- Images are copied only with `--download-assets`, only from inside the input directory, and only if they are common image types; absolute, `file:`, `data:` and `//` sources and symlinks are not copied, and copied files keep only their base name
|
|
38
|
+
- The output path may not equal or sit inside the input path
|
|
39
|
+
- Input files over 1 MiB are rejected, symlinked input files are skipped, and link and image patterns are length-bounded
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
- `--use-ai-description` flag and the placeholder AI description code (AI descriptions are future work)
|
|
43
|
+
- Legacy standalone script `mintlify_convert.py`
|
|
44
|
+
- Documentation of flags that never existed (`--no-validate`, `--parallel`, `--workers`, `--no-download-assets`) and of environment variables and exit codes the code does not implement
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- Pathological input no longer causes slow conversion: 20,000 consecutive `Python:` label lines and 100,000 repeated `[a](` sequences each convert in under a second in a local run
|
|
48
|
+
- A page whose first prose line is a tab label no longer uses it as the description
|
|
49
|
+
- Broken links between documentation pages and placeholder URLs in the README and guides
|
|
50
|
+
|
|
51
|
+
## Earlier history (dates unverified; carried over from the original file)
|
|
52
|
+
|
|
53
|
+
The repository contains a single commit (2025-10-13). The release dates and the v1.x history below could not be verified and are kept as originally written, except for the two lines noted under 2.0.0.
|
|
54
|
+
|
|
55
|
+
### [2.0.0] - 2024-01-01
|
|
56
|
+
|
|
57
|
+
#### Added
|
|
58
|
+
- Enhanced Mintlify component support (Accordion, Tabs, Banner, Callout)
|
|
59
|
+
- Advanced navigation generation with nested groups
|
|
60
|
+
- Asset handling and image copying
|
|
61
|
+
- MDX validation with detailed error reporting
|
|
62
|
+
- ~~AI description generation (placeholder for OpenAI integration)~~ Not implemented; the placeholder was removed (see Unreleased)
|
|
63
|
+
- Comprehensive command-line interface
|
|
64
|
+
- Custom branding options for mint.json
|
|
65
|
+
- ~~Parallel processing support (future feature)~~ Not implemented; never available
|
|
66
|
+
|
|
67
|
+
#### Changed
|
|
68
|
+
- Complete rewrite from v1.x
|
|
69
|
+
- Improved component mapping accuracy
|
|
70
|
+
- Enhanced error handling and validation
|
|
71
|
+
- Better support for complex documentation structures
|
|
72
|
+
|
|
73
|
+
#### Fixed
|
|
74
|
+
- Unclosed tag detection in MDX validation
|
|
75
|
+
- Image path resolution issues
|
|
76
|
+
- Navigation structure generation
|
|
77
|
+
- Component conversion edge cases
|
|
78
|
+
|
|
79
|
+
### [1.0.0] - 2023-12-01
|
|
80
|
+
|
|
81
|
+
#### Added
|
|
82
|
+
- Initial release
|
|
83
|
+
- Basic MDX to Mintlify conversion
|
|
84
|
+
- Core component mapping (Callouts, Steps, Cards)
|
|
85
|
+
- Simple navigation generation
|
|
86
|
+
- Command-line interface
|
|
87
|
+
- Basic validation
|
|
88
|
+
|
|
89
|
+
#### Features
|
|
90
|
+
- Convert blockquotes to Callout components
|
|
91
|
+
- Transform numbered lists to Steps
|
|
92
|
+
- Generate help sections as Cards
|
|
93
|
+
- Create basic mint.json files
|
|
94
|
+
- Process single files and directories
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mintlify Convert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mintlify-convert
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Convert MDX documentation to Mintlify format
|
|
5
|
+
Author-email: olamide_codex <oluwamusiwaolamide@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Olamideod/mintlify-convert
|
|
8
|
+
Project-URL: Repository, https://github.com/Olamideod/mintlify-convert.git
|
|
9
|
+
Project-URL: Issues, https://github.com/Olamideod/mintlify-convert/issues
|
|
10
|
+
Keywords: mintlify,mdx,documentation,conversion,migration
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
20
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
31
|
+
Requires-Dist: jsonschema>=4; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# Mintlify Convert
|
|
35
|
+
|
|
36
|
+
[](https://opensource.org/licenses/MIT)
|
|
37
|
+
|
|
38
|
+
Convert MDX documentation to Mintlify format with enhanced features for seamless migration.
|
|
39
|
+
|
|
40
|
+
## ✨ Features
|
|
41
|
+
|
|
42
|
+
### 🎯 Core Conversions
|
|
43
|
+
- ✅ Frontmatter generation (title, description, icon, mode)
|
|
44
|
+
- ✅ Callouts/Admonitions → Proper Mintlify components (`<Warning>`, `<Tip>`, `<Note>`, `<Info>`, `<Check>`)
|
|
45
|
+
- ✅ Numbered lists → one `<Steps>` per list, with plain-text titles taken from each step
|
|
46
|
+
- ✅ Help sections → `<Card>` components with contextual icons
|
|
47
|
+
- ✅ API links → Mintlify API reference format
|
|
48
|
+
- ✅ Code blocks with proper formatting
|
|
49
|
+
|
|
50
|
+
### 🧩 Advanced Components (Enhanced with Technical Writing Rules)
|
|
51
|
+
- ✅ `<Accordion>` for H3 sections whose titles match a keyword heuristic (troubleshooting, FAQ, advanced, common issues, known issues, error codes, walkthrough, step by step, breakdown)
|
|
52
|
+
- ✅ `<Tabs>` and `<Tab>` for language-labelled code blocks, with display names such as "JavaScript"
|
|
53
|
+
- ✅ `<Banner>` for paragraphs that start with "Deprecated:", "Important:", "Notice:" or "Alert:"
|
|
54
|
+
- ✅ `<Frame>` around images that are copied with `--download-assets`
|
|
55
|
+
|
|
56
|
+
### 🧭 Navigation
|
|
57
|
+
- ✅ `docs.json` generation (default), or legacy `mint.json` with `--legacy-mint-json`
|
|
58
|
+
- ✅ Nested groups based on folder structure ("Getting Started" first, then "Documentation", then A-Z)
|
|
59
|
+
- ✅ Proper page titles from frontmatter
|
|
60
|
+
- ✅ Optional alphabetical sorting
|
|
61
|
+
|
|
62
|
+
### 🖼️ Asset Handling
|
|
63
|
+
- ✅ Image copying to `/images` directory (only with `--download-assets`, only from inside the input directory)
|
|
64
|
+
- ✅ Relative link rewriting (links that resolve outside the input directory are left unchanged)
|
|
65
|
+
- ✅ Automatic path correction
|
|
66
|
+
|
|
67
|
+
### 🔧 Quality Assurance
|
|
68
|
+
- ✅ Input files over 1 MiB are rejected; symlinked inputs and `file:` images are skipped with a warning on stderr
|
|
69
|
+
- ✅ MDX validation (unclosed or mismatched tags; code blocks are ignored)
|
|
70
|
+
- ✅ Detailed error reporting
|
|
71
|
+
- ✅ Verbose mode for debugging
|
|
72
|
+
|
|
73
|
+
## 🚀 Quick Start
|
|
74
|
+
|
|
75
|
+
### Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# From source (Python 3.10 or newer)
|
|
79
|
+
git clone https://github.com/Olamideod/mintlify-convert.git
|
|
80
|
+
cd mintlify-convert
|
|
81
|
+
pip install -e .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The package is not yet published to PyPI.
|
|
85
|
+
|
|
86
|
+
### Basic Usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Convert a single file
|
|
90
|
+
mintlify-convert input.mdx -o output.mdx
|
|
91
|
+
|
|
92
|
+
# Convert an entire directory
|
|
93
|
+
mintlify-convert docs/ -o mintlify-docs/
|
|
94
|
+
|
|
95
|
+
# With all features
|
|
96
|
+
mintlify-convert docs/ -o mintlify-docs/ \
|
|
97
|
+
--generate-config \
|
|
98
|
+
--download-assets \
|
|
99
|
+
--validate \
|
|
100
|
+
--sort-pages
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`--generate-config` writes `docs.json`. Add `--legacy-mint-json` to write `mint.json` instead. `--generate-mint-json` is a deprecated alias for both flags together.
|
|
104
|
+
|
|
105
|
+
Converting is idempotent: running the tool on its own output produces the same output. The output path must not be the same as, or inside, the input path.
|
|
106
|
+
|
|
107
|
+
## 📖 Documentation
|
|
108
|
+
|
|
109
|
+
- **[Getting Started](docs/getting-started.mdx)** - Quick start guide
|
|
110
|
+
- **[API Reference](docs/api-reference.mdx)** - Complete CLI and programmatic API
|
|
111
|
+
- **[Component Mapping](docs/component-mapping.mdx)** - How patterns are converted
|
|
112
|
+
- **[Troubleshooting](docs/troubleshooting.mdx)** - Common issues and solutions
|
|
113
|
+
|
|
114
|
+
## 🎯 Component Conversions
|
|
115
|
+
|
|
116
|
+
### Callouts (Enhanced)
|
|
117
|
+
**Input:**
|
|
118
|
+
```markdown
|
|
119
|
+
> **Warning:** This is a critical note.
|
|
120
|
+
> Please read carefully.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Output:**
|
|
124
|
+
```mdx
|
|
125
|
+
<Warning>
|
|
126
|
+
**Warning:** This is a critical note.
|
|
127
|
+
Please read carefully.
|
|
128
|
+
</Warning>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Steps (Enhanced with Smart Titles)
|
|
132
|
+
**Input:**
|
|
133
|
+
```markdown
|
|
134
|
+
1. Install dependencies using npm
|
|
135
|
+
2. Configure your environment variables
|
|
136
|
+
3. Start the development server
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Output:**
|
|
140
|
+
```mdx
|
|
141
|
+
<Steps>
|
|
142
|
+
<Step title="Install dependencies using npm">
|
|
143
|
+
Install dependencies using npm
|
|
144
|
+
</Step>
|
|
145
|
+
<Step title="Configure your environment variables">
|
|
146
|
+
Configure your environment variables
|
|
147
|
+
</Step>
|
|
148
|
+
<Step title="Start the development server">
|
|
149
|
+
Start the development server
|
|
150
|
+
</Step>
|
|
151
|
+
</Steps>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Tabs (Enhanced Language Support)
|
|
155
|
+
**Input:**
|
|
156
|
+
```markdown
|
|
157
|
+
JavaScript:
|
|
158
|
+
const api = require('api');
|
|
159
|
+
|
|
160
|
+
Python:
|
|
161
|
+
import api
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Output:**
|
|
165
|
+
````mdx
|
|
166
|
+
<Tabs>
|
|
167
|
+
<Tab title="JavaScript">
|
|
168
|
+
```javascript
|
|
169
|
+
const api = require('api');
|
|
170
|
+
```
|
|
171
|
+
</Tab>
|
|
172
|
+
<Tab title="Python">
|
|
173
|
+
```python
|
|
174
|
+
import api
|
|
175
|
+
```
|
|
176
|
+
</Tab>
|
|
177
|
+
</Tabs>
|
|
178
|
+
````
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
### Setup
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/Olamideod/mintlify-convert.git
|
|
185
|
+
cd mintlify-convert
|
|
186
|
+
pip install -e ".[dev]"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Run Tests
|
|
190
|
+
```bash
|
|
191
|
+
pytest tests/ -v --cov=mintlify_convert
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Run Mintlify Convert
|
|
195
|
+
```bash
|
|
196
|
+
# Convert all MDX files in docs/ and write docs.json
|
|
197
|
+
python -m mintlify_convert.cli docs/ -o mintlify-docs/ --generate-config
|
|
198
|
+
|
|
199
|
+
# Convert a single file
|
|
200
|
+
python -m mintlify_convert.cli doc.mdx -o output.mdx
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Conversion behaviour
|
|
204
|
+
The converter follows the component guidance in [agent.md](agent.md):
|
|
205
|
+
|
|
206
|
+
- Callouts become `<Warning>`, `<Tip>`, `<Note>`, `<Info>` or `<Check>`
|
|
207
|
+
- Numbered lists become `<Steps>` with descriptive titles taken from each step
|
|
208
|
+
- Accordions, Banners and Frames follow the narrow rules listed under Features
|
|
209
|
+
- Callouts, banners and numbered lists that start with a code fence are left unconverted; banners and help cards only match at the start of a paragraph
|
|
210
|
+
- Three or more consecutive language-labelled blocks form one `<Tabs>` group
|
|
211
|
+
- Code fences are left untouched
|
|
212
|
+
|
|
213
|
+
### Code Formatting
|
|
214
|
+
```bash
|
|
215
|
+
black mintlify_convert/
|
|
216
|
+
flake8 mintlify_convert/
|
|
217
|
+
mypy mintlify_convert/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Project Structure
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
mintlify-convert/
|
|
224
|
+
├── mintlify_convert/ # Main package
|
|
225
|
+
│ ├── __init__.py # Package initialization
|
|
226
|
+
│ ├── cli.py # Command-line interface
|
|
227
|
+
│ ├── converter.py # Core conversion logic
|
|
228
|
+
│ ├── navigation.py # docs.json / mint.json generation
|
|
229
|
+
│ └── utils.py # Helper utilities
|
|
230
|
+
│
|
|
231
|
+
├── tests/ # Test suite
|
|
232
|
+
│ ├── test_converter.py # Unit tests for converter
|
|
233
|
+
│ ├── test_integration.py # Integration tests
|
|
234
|
+
│ ├── test_navigation.py # Navigation tests
|
|
235
|
+
│ └── fixtures/ # Test fixtures
|
|
236
|
+
│
|
|
237
|
+
├── examples/ # Example conversions
|
|
238
|
+
│ ├── basic/ # Basic examples
|
|
239
|
+
│ ├── advanced/ # Advanced examples
|
|
240
|
+
│ └── full-migration/ # Complete migration example
|
|
241
|
+
│
|
|
242
|
+
├── docs/ # Package documentation
|
|
243
|
+
│ ├── getting-started.mdx
|
|
244
|
+
│ ├── api-reference.mdx
|
|
245
|
+
│ ├── component-mapping.mdx
|
|
246
|
+
│ └── troubleshooting.mdx
|
|
247
|
+
│
|
|
248
|
+
├── .github/
|
|
249
|
+
│ └── workflows/ # CI/CD workflows
|
|
250
|
+
│
|
|
251
|
+
├── pyproject.toml # Modern Python project config
|
|
252
|
+
├── requirements.txt # Dependencies
|
|
253
|
+
├── requirements-dev.txt # Development dependencies
|
|
254
|
+
├── README.md # This file
|
|
255
|
+
├── LICENSE # MIT License
|
|
256
|
+
├── CHANGELOG.md # Version history
|
|
257
|
+
├── agent.md # Mintlify technical writing rules
|
|
258
|
+
└── .gitignore # Git ignore rules
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 🗺️ Roadmap
|
|
262
|
+
|
|
263
|
+
### Future work
|
|
264
|
+
- [ ] AI-powered description generation (not implemented)
|
|
265
|
+
- [ ] Parallel processing for large docs (not implemented)
|
|
266
|
+
- [ ] Interactive migration wizard (TUI)
|
|
267
|
+
- [ ] Incremental conversion (only changed files)
|
|
268
|
+
- [ ] Custom component plugins
|
|
269
|
+
- [ ] Automatic image optimization
|
|
270
|
+
- [ ] Diff viewer for conversions
|
|
271
|
+
- [ ] VS Code extension
|
|
272
|
+
- [ ] Web-based converter UI
|
|
273
|
+
- [ ] Support for Docusaurus → Mintlify
|
|
274
|
+
- [ ] Support for GitBook → Mintlify
|
|
275
|
+
- [ ] Migration analytics and reporting
|
|
276
|
+
|
|
277
|
+
## 🤝 Contributing
|
|
278
|
+
|
|
279
|
+
Contributions are welcome! Please:
|
|
280
|
+
|
|
281
|
+
1. Fork the repository
|
|
282
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
283
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
284
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
285
|
+
5. Open a Pull Request
|
|
286
|
+
|
|
287
|
+
## 📄 License
|
|
288
|
+
|
|
289
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
290
|
+
|
|
291
|
+
## Support
|
|
292
|
+
|
|
293
|
+
- Issues: [GitHub Issues](https://github.com/Olamideod/mintlify-convert/issues)
|
|
294
|
+
|
|
295
|
+
## 🙏 Acknowledgments
|
|
296
|
+
|
|
297
|
+
Built with ❤️ to help teams migrate to Mintlify faster.
|
|
298
|
+
|
|
299
|
+
*Star ⭐ this repo if it helped you!*
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Mintlify Convert
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
Convert MDX documentation to Mintlify format with enhanced features for seamless migration.
|
|
6
|
+
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
### 🎯 Core Conversions
|
|
10
|
+
- ✅ Frontmatter generation (title, description, icon, mode)
|
|
11
|
+
- ✅ Callouts/Admonitions → Proper Mintlify components (`<Warning>`, `<Tip>`, `<Note>`, `<Info>`, `<Check>`)
|
|
12
|
+
- ✅ Numbered lists → one `<Steps>` per list, with plain-text titles taken from each step
|
|
13
|
+
- ✅ Help sections → `<Card>` components with contextual icons
|
|
14
|
+
- ✅ API links → Mintlify API reference format
|
|
15
|
+
- ✅ Code blocks with proper formatting
|
|
16
|
+
|
|
17
|
+
### 🧩 Advanced Components (Enhanced with Technical Writing Rules)
|
|
18
|
+
- ✅ `<Accordion>` for H3 sections whose titles match a keyword heuristic (troubleshooting, FAQ, advanced, common issues, known issues, error codes, walkthrough, step by step, breakdown)
|
|
19
|
+
- ✅ `<Tabs>` and `<Tab>` for language-labelled code blocks, with display names such as "JavaScript"
|
|
20
|
+
- ✅ `<Banner>` for paragraphs that start with "Deprecated:", "Important:", "Notice:" or "Alert:"
|
|
21
|
+
- ✅ `<Frame>` around images that are copied with `--download-assets`
|
|
22
|
+
|
|
23
|
+
### 🧭 Navigation
|
|
24
|
+
- ✅ `docs.json` generation (default), or legacy `mint.json` with `--legacy-mint-json`
|
|
25
|
+
- ✅ Nested groups based on folder structure ("Getting Started" first, then "Documentation", then A-Z)
|
|
26
|
+
- ✅ Proper page titles from frontmatter
|
|
27
|
+
- ✅ Optional alphabetical sorting
|
|
28
|
+
|
|
29
|
+
### 🖼️ Asset Handling
|
|
30
|
+
- ✅ Image copying to `/images` directory (only with `--download-assets`, only from inside the input directory)
|
|
31
|
+
- ✅ Relative link rewriting (links that resolve outside the input directory are left unchanged)
|
|
32
|
+
- ✅ Automatic path correction
|
|
33
|
+
|
|
34
|
+
### 🔧 Quality Assurance
|
|
35
|
+
- ✅ Input files over 1 MiB are rejected; symlinked inputs and `file:` images are skipped with a warning on stderr
|
|
36
|
+
- ✅ MDX validation (unclosed or mismatched tags; code blocks are ignored)
|
|
37
|
+
- ✅ Detailed error reporting
|
|
38
|
+
- ✅ Verbose mode for debugging
|
|
39
|
+
|
|
40
|
+
## 🚀 Quick Start
|
|
41
|
+
|
|
42
|
+
### Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# From source (Python 3.10 or newer)
|
|
46
|
+
git clone https://github.com/Olamideod/mintlify-convert.git
|
|
47
|
+
cd mintlify-convert
|
|
48
|
+
pip install -e .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The package is not yet published to PyPI.
|
|
52
|
+
|
|
53
|
+
### Basic Usage
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Convert a single file
|
|
57
|
+
mintlify-convert input.mdx -o output.mdx
|
|
58
|
+
|
|
59
|
+
# Convert an entire directory
|
|
60
|
+
mintlify-convert docs/ -o mintlify-docs/
|
|
61
|
+
|
|
62
|
+
# With all features
|
|
63
|
+
mintlify-convert docs/ -o mintlify-docs/ \
|
|
64
|
+
--generate-config \
|
|
65
|
+
--download-assets \
|
|
66
|
+
--validate \
|
|
67
|
+
--sort-pages
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`--generate-config` writes `docs.json`. Add `--legacy-mint-json` to write `mint.json` instead. `--generate-mint-json` is a deprecated alias for both flags together.
|
|
71
|
+
|
|
72
|
+
Converting is idempotent: running the tool on its own output produces the same output. The output path must not be the same as, or inside, the input path.
|
|
73
|
+
|
|
74
|
+
## 📖 Documentation
|
|
75
|
+
|
|
76
|
+
- **[Getting Started](docs/getting-started.mdx)** - Quick start guide
|
|
77
|
+
- **[API Reference](docs/api-reference.mdx)** - Complete CLI and programmatic API
|
|
78
|
+
- **[Component Mapping](docs/component-mapping.mdx)** - How patterns are converted
|
|
79
|
+
- **[Troubleshooting](docs/troubleshooting.mdx)** - Common issues and solutions
|
|
80
|
+
|
|
81
|
+
## 🎯 Component Conversions
|
|
82
|
+
|
|
83
|
+
### Callouts (Enhanced)
|
|
84
|
+
**Input:**
|
|
85
|
+
```markdown
|
|
86
|
+
> **Warning:** This is a critical note.
|
|
87
|
+
> Please read carefully.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Output:**
|
|
91
|
+
```mdx
|
|
92
|
+
<Warning>
|
|
93
|
+
**Warning:** This is a critical note.
|
|
94
|
+
Please read carefully.
|
|
95
|
+
</Warning>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Steps (Enhanced with Smart Titles)
|
|
99
|
+
**Input:**
|
|
100
|
+
```markdown
|
|
101
|
+
1. Install dependencies using npm
|
|
102
|
+
2. Configure your environment variables
|
|
103
|
+
3. Start the development server
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Output:**
|
|
107
|
+
```mdx
|
|
108
|
+
<Steps>
|
|
109
|
+
<Step title="Install dependencies using npm">
|
|
110
|
+
Install dependencies using npm
|
|
111
|
+
</Step>
|
|
112
|
+
<Step title="Configure your environment variables">
|
|
113
|
+
Configure your environment variables
|
|
114
|
+
</Step>
|
|
115
|
+
<Step title="Start the development server">
|
|
116
|
+
Start the development server
|
|
117
|
+
</Step>
|
|
118
|
+
</Steps>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Tabs (Enhanced Language Support)
|
|
122
|
+
**Input:**
|
|
123
|
+
```markdown
|
|
124
|
+
JavaScript:
|
|
125
|
+
const api = require('api');
|
|
126
|
+
|
|
127
|
+
Python:
|
|
128
|
+
import api
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Output:**
|
|
132
|
+
````mdx
|
|
133
|
+
<Tabs>
|
|
134
|
+
<Tab title="JavaScript">
|
|
135
|
+
```javascript
|
|
136
|
+
const api = require('api');
|
|
137
|
+
```
|
|
138
|
+
</Tab>
|
|
139
|
+
<Tab title="Python">
|
|
140
|
+
```python
|
|
141
|
+
import api
|
|
142
|
+
```
|
|
143
|
+
</Tab>
|
|
144
|
+
</Tabs>
|
|
145
|
+
````
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
### Setup
|
|
150
|
+
```bash
|
|
151
|
+
git clone https://github.com/Olamideod/mintlify-convert.git
|
|
152
|
+
cd mintlify-convert
|
|
153
|
+
pip install -e ".[dev]"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Run Tests
|
|
157
|
+
```bash
|
|
158
|
+
pytest tests/ -v --cov=mintlify_convert
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Run Mintlify Convert
|
|
162
|
+
```bash
|
|
163
|
+
# Convert all MDX files in docs/ and write docs.json
|
|
164
|
+
python -m mintlify_convert.cli docs/ -o mintlify-docs/ --generate-config
|
|
165
|
+
|
|
166
|
+
# Convert a single file
|
|
167
|
+
python -m mintlify_convert.cli doc.mdx -o output.mdx
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Conversion behaviour
|
|
171
|
+
The converter follows the component guidance in [agent.md](agent.md):
|
|
172
|
+
|
|
173
|
+
- Callouts become `<Warning>`, `<Tip>`, `<Note>`, `<Info>` or `<Check>`
|
|
174
|
+
- Numbered lists become `<Steps>` with descriptive titles taken from each step
|
|
175
|
+
- Accordions, Banners and Frames follow the narrow rules listed under Features
|
|
176
|
+
- Callouts, banners and numbered lists that start with a code fence are left unconverted; banners and help cards only match at the start of a paragraph
|
|
177
|
+
- Three or more consecutive language-labelled blocks form one `<Tabs>` group
|
|
178
|
+
- Code fences are left untouched
|
|
179
|
+
|
|
180
|
+
### Code Formatting
|
|
181
|
+
```bash
|
|
182
|
+
black mintlify_convert/
|
|
183
|
+
flake8 mintlify_convert/
|
|
184
|
+
mypy mintlify_convert/
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Project Structure
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
mintlify-convert/
|
|
191
|
+
├── mintlify_convert/ # Main package
|
|
192
|
+
│ ├── __init__.py # Package initialization
|
|
193
|
+
│ ├── cli.py # Command-line interface
|
|
194
|
+
│ ├── converter.py # Core conversion logic
|
|
195
|
+
│ ├── navigation.py # docs.json / mint.json generation
|
|
196
|
+
│ └── utils.py # Helper utilities
|
|
197
|
+
│
|
|
198
|
+
├── tests/ # Test suite
|
|
199
|
+
│ ├── test_converter.py # Unit tests for converter
|
|
200
|
+
│ ├── test_integration.py # Integration tests
|
|
201
|
+
│ ├── test_navigation.py # Navigation tests
|
|
202
|
+
│ └── fixtures/ # Test fixtures
|
|
203
|
+
│
|
|
204
|
+
├── examples/ # Example conversions
|
|
205
|
+
│ ├── basic/ # Basic examples
|
|
206
|
+
│ ├── advanced/ # Advanced examples
|
|
207
|
+
│ └── full-migration/ # Complete migration example
|
|
208
|
+
│
|
|
209
|
+
├── docs/ # Package documentation
|
|
210
|
+
│ ├── getting-started.mdx
|
|
211
|
+
│ ├── api-reference.mdx
|
|
212
|
+
│ ├── component-mapping.mdx
|
|
213
|
+
│ └── troubleshooting.mdx
|
|
214
|
+
│
|
|
215
|
+
├── .github/
|
|
216
|
+
│ └── workflows/ # CI/CD workflows
|
|
217
|
+
│
|
|
218
|
+
├── pyproject.toml # Modern Python project config
|
|
219
|
+
├── requirements.txt # Dependencies
|
|
220
|
+
├── requirements-dev.txt # Development dependencies
|
|
221
|
+
├── README.md # This file
|
|
222
|
+
├── LICENSE # MIT License
|
|
223
|
+
├── CHANGELOG.md # Version history
|
|
224
|
+
├── agent.md # Mintlify technical writing rules
|
|
225
|
+
└── .gitignore # Git ignore rules
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 🗺️ Roadmap
|
|
229
|
+
|
|
230
|
+
### Future work
|
|
231
|
+
- [ ] AI-powered description generation (not implemented)
|
|
232
|
+
- [ ] Parallel processing for large docs (not implemented)
|
|
233
|
+
- [ ] Interactive migration wizard (TUI)
|
|
234
|
+
- [ ] Incremental conversion (only changed files)
|
|
235
|
+
- [ ] Custom component plugins
|
|
236
|
+
- [ ] Automatic image optimization
|
|
237
|
+
- [ ] Diff viewer for conversions
|
|
238
|
+
- [ ] VS Code extension
|
|
239
|
+
- [ ] Web-based converter UI
|
|
240
|
+
- [ ] Support for Docusaurus → Mintlify
|
|
241
|
+
- [ ] Support for GitBook → Mintlify
|
|
242
|
+
- [ ] Migration analytics and reporting
|
|
243
|
+
|
|
244
|
+
## 🤝 Contributing
|
|
245
|
+
|
|
246
|
+
Contributions are welcome! Please:
|
|
247
|
+
|
|
248
|
+
1. Fork the repository
|
|
249
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
250
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
251
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
252
|
+
5. Open a Pull Request
|
|
253
|
+
|
|
254
|
+
## 📄 License
|
|
255
|
+
|
|
256
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
257
|
+
|
|
258
|
+
## Support
|
|
259
|
+
|
|
260
|
+
- Issues: [GitHub Issues](https://github.com/Olamideod/mintlify-convert/issues)
|
|
261
|
+
|
|
262
|
+
## 🙏 Acknowledgments
|
|
263
|
+
|
|
264
|
+
Built with ❤️ to help teams migrate to Mintlify faster.
|
|
265
|
+
|
|
266
|
+
*Star ⭐ this repo if it helped you!*
|