@@ -14,13 +14,15 @@ Djot is a light markup syntax created by John MacFarlane (creator of CommonMark
1414## Features
1515
1616- ** Full Djot Support** : Headings, emphasis, links, images, code blocks, tables, footnotes, and more
17+ - ** Block Editor Support** : Native Gutenberg block for writing Djot with live preview
1718- ** Shortcode Support** : Use ` [djot]...[/djot] ` in your content
1819- ** Content Filtering** : Automatically process ` {djot}...{/djot} ` blocks in posts and pages
1920- ** Safe Mode** : XSS protection for untrusted content (enabled by default for comments)
2021- ** Syntax Highlighting** : Built-in highlight.js integration with multiple themes
2122- ** Admin Settings** : Easy configuration through WordPress admin
2223- ** Template Tags** : ` djot_to_html() ` and ` the_djot() ` for theme developers
2324- ** Dark Mode Support** : CSS automatically adapts to dark mode preferences
25+ - ** WP-CLI Migration** : Migrate existing HTML/Markdown content to Djot with rollback support
2426
2527## Requirements
2628
@@ -47,6 +49,16 @@ Search for "WP Djot" in the WordPress plugin directory.
4749
4850## Usage
4951
52+ ### Block Editor (Gutenberg)
53+
54+ Add a ** Djot** block from the block inserter (search for "Djot"). The block provides:
55+
56+ - A code editor for writing Djot markup
57+ - Live preview toggle in the sidebar
58+ - Server-side rendering for accurate output
59+
60+ Simply write your Djot content and toggle preview to see the rendered HTML.
61+
5062### Shortcode
5163
5264```
@@ -161,37 +173,86 @@ add_filter('wp_djot_post_convert', function(string $html): string {
161173});
162174```
163175
164- ## Development
176+ ## WP-CLI Commands
165177
166- ### Running Tests
178+ Migrate existing HTML or Markdown content to Djot format using WP-CLI.
179+
180+ ### Analyze Content
181+
182+ Analyze posts to determine migration complexity before converting:
167183
168184``` bash
169- composer install
170- composer test
185+ # Analyze all posts and pages
186+ wp djot analyze
187+
188+ # Analyze a specific post
189+ wp djot analyze --post-id=123
190+
191+ # Analyze only posts, limit to 10
192+ wp djot analyze --post-type=post --limit=10
193+
194+ # Output as JSON
195+ wp djot analyze --format=json
171196```
172197
173- ### Code Style
198+ The analysis shows:
199+ - ** Complexity** : none, low, medium, high
200+ - ** Content types** : HTML, Markdown, Gutenberg blocks, shortcodes
201+ - ** Auto-migrate** : Whether the post can be safely auto-migrated
202+
203+ ### Migrate Content
204+
205+ Convert posts from HTML/Markdown to Djot:
174206
175207``` bash
176- composer cs-check
177- composer cs-fix
208+ # Migrate a single post
209+ wp djot migrate --post-id=123
210+
211+ # Preview migration without saving (dry run)
212+ wp djot migrate --dry-run
213+
214+ # Preview with content diff
215+ wp djot migrate --dry-run --show-diff --post-id=123
216+
217+ # Migrate posts in batches
218+ wp djot migrate --post-type=post --limit=10
219+
220+ # Force migration of high-complexity posts
221+ wp djot migrate --post-id=123 --force
178222```
179223
180- ### Static Analysis
224+ ** Features:**
225+ - Automatic backup of original content
226+ - Preserves WordPress shortcodes
227+ - Preserves Gutenberg blocks
228+ - Converts HTML tags to Djot syntax
229+ - Converts Markdown syntax to Djot
230+
231+ ### Rollback Migrations
232+
233+ Restore posts to their original content:
181234
182235``` bash
183- composer stan
236+ # Rollback a single post
237+ wp djot rollback --post-id=123
238+
239+ # Rollback all migrated posts
240+ wp djot rollback --all
184241```
185242
186- ## Contributing
243+ ### Migration Status
187244
188- Contributions are welcome! Please feel free to submit a Pull Request.
245+ View migration statistics:
189246
190- 1 . Fork the repository
191- 2 . Create your feature branch (` git checkout -b feature/amazing-feature ` )
192- 3 . Commit your changes (` git commit -m 'Add some amazing feature' ` )
193- 4 . Push to the branch (` git push origin feature/amazing-feature ` )
194- 5 . Open a Pull Request
247+ ``` bash
248+ wp djot status
249+ ```
250+
251+ Shows count of migrated posts, pending posts, and complexity distribution.
252+
253+ ## Contributing
254+
255+ Contributions are welcome! See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for development setup and guidelines.
195256
196257## License
197258
@@ -205,12 +266,13 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
205266
206267## Changelog
207268
208- ### 1.0.0
269+ See [ CHANGELOG.md] ( CHANGELOG.md ) for full history.
270+
271+ ### 0.1.0
209272
210- - Initial release
211- - Full Djot syntax support
273+ - Initial release with full Djot syntax support
212274- Shortcode and content filtering
213- - Admin settings page
214- - Syntax highlighting with highlight.js
275+ - Admin settings page with syntax highlighting
215276- Safe mode for untrusted content
216277- Template tags for theme developers
278+ - WP-CLI migration commands for HTML/Markdown to Djot conversion
0 commit comments