Skip to content

Latest commit

 

History

History
179 lines (127 loc) · 3.81 KB

File metadata and controls

179 lines (127 loc) · 3.81 KB

Installation Guide

Quick Start

1. Copy Plugin to WordPress

cp -r domscribe-wordpress /path/to/wordpress/wp-content/plugins/

Or simply extract the zip file in your plugins directory.

2. Activate in WordPress

  1. Go to WordPress Admin → Plugins
  2. Find "Domscribe WordPress" and click "Activate"

Note: No composer install needed! All dependencies are bundled.

3. Configure Settings

  1. Go to Settings → Domscribe
  2. Enable markdown conversion
  3. Configure your preferred options
  4. Save settings

Testing

Using cURL

# Test a single post
curl -H "Accept: text/markdown" http://your-wordpress-site.local/sample-post/

# Save to file
curl -H "Accept: text/markdown" http://your-wordpress-site.local/sample-post/ > post.md

# Check headers
curl -I -H "Accept: text/markdown" http://your-wordpress-site.local/sample-post/

Using HTTPie

http http://your-wordpress-site.local/sample-post/ Accept:text/markdown

Using PHP

<?php
$ch = curl_init('http://your-wordpress-site.local/sample-post/');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: text/markdown']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$markdown = curl_exec($ch);
curl_close($ch);

echo $markdown;

Using JavaScript/Fetch

fetch('http://your-wordpress-site.local/sample-post/', {
    headers: {
        'Accept': 'text/markdown'
    }
})
.then(response => response.text())
.then(markdown => console.log(markdown));

Development Setup

Local WordPress with Docker

# Start WordPress
docker-compose up -d

# Install plugin
docker-compose exec wordpress wp plugin activate domscribe-wordpress

# Check status
docker-compose exec wordpress wp plugin list

Using Local by Flywheel

  1. Create new site in Local
  2. Add plugin to app/public/wp-content/plugins/
  3. Activate via WP Admin

Using XAMPP/MAMP

  1. Copy plugin to htdocs/wordpress/wp-content/plugins/
  2. Activate via WP Admin

Troubleshooting

Plugin Not Working

  1. Check PHP version (must be 8.0+):

    php -v
  2. Verify bundled libraries exist:

    ls lib/domscribe/
    ls lib/html5/
  3. Check error logs:

    tail -f wp-content/debug.log
  4. Enable WordPress debug mode in wp-config.php:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);

Cache Issues

Clear cache via:

  1. Settings → Domscribe → Clear All Cache
  2. Or programmatically:
    domscribe_wp()->get_request_handler()->clear_all_cache();

Production Deployment

Via Git

cd wp-content/plugins
git clone https://github.com/acseo/domscribe-wordpress.git

No additional steps needed!

Via FTP

  1. Download plugin zip
  2. Upload entire plugin directory via FTP
  3. Activate in WordPress admin

Best Practices

  • Use --no-dev for production
  • Enable caching for better performance
  • Set appropriate cache duration
  • Monitor cache size
  • Use a CDN if serving many markdown requests

Security Considerations

  1. Nonce Verification: All forms use WordPress nonces
  2. Capability Checks: Admin functions check user capabilities
  3. Input Sanitization: All inputs are sanitized
  4. Output Escaping: All outputs are escaped
  5. Cache Security: Caches are stored as transients (secure)

Performance Tips

  1. Enable Caching: Always enable caching in production
  2. Set Appropriate Duration: Balance freshness vs performance
  3. Use Object Cache: Install Redis/Memcached for better caching
  4. Monitor Requests: Track markdown request patterns
  5. CDN Integration: Consider CDN for static markdown exports

Next Steps