Add post synchronization functionality for Markdown files

- Implemented a parser for YAML front-matter in Markdown files.
- Developed functions to convert Markdown content to HTML.
- Created a pipeline to sync WordPress posts from a specified folder in a Git repository.
- Added media import capabilities to handle images referenced in Markdown.
- Implemented author resolution and post slug generation.
- Included error handling and logging for sync operations.
- Enabled trashing of posts that are no longer present in the repository.
This commit is contained in:
Matt Batchelder
2026-02-21 10:44:34 -05:00
parent 3c8c38acde
commit d56d46490a
6 changed files with 1219 additions and 51 deletions

View File

@@ -20,6 +20,7 @@ require_once ORIBI_SYNC_DIR . 'includes/crypto.php';
require_once ORIBI_SYNC_DIR . 'includes/api-client.php';
require_once ORIBI_SYNC_DIR . 'includes/sync-engine.php';
require_once ORIBI_SYNC_DIR . 'includes/push-client.php';
require_once ORIBI_SYNC_DIR . 'includes/post-sync.php';
require_once ORIBI_SYNC_DIR . 'includes/admin.php';
require_once ORIBI_SYNC_DIR . 'includes/rest.php';
require_once ORIBI_SYNC_DIR . 'includes/theme-preview.php';
@@ -30,12 +31,14 @@ register_deactivation_hook( __FILE__, 'oribi_sync_deactivate' );
function oribi_sync_activate() {
// Ensure default options exist
add_option( 'oribi_sync_repo', '', '', 'no' );
add_option( 'oribi_sync_branch', 'main', '', 'no' );
add_option( 'oribi_sync_provider', '', '', 'no' );
add_option( 'oribi_sync_pat', '', '', 'no' );
add_option( 'oribi_sync_last_run', '', '', 'no' );
add_option( 'oribi_sync_log', [], '', 'no' );
add_option( 'oribi_sync_repo', '', '', 'no' );
add_option( 'oribi_sync_branch', 'main', '', 'no' );
add_option( 'oribi_sync_provider', '', '', 'no' );
add_option( 'oribi_sync_pat', '', '', 'no' );
add_option( 'oribi_sync_last_run', '', '', 'no' );
add_option( 'oribi_sync_log', [], '', 'no' );
add_option( 'oribi_sync_posts_enabled', '', '', 'no' );
add_option( 'oribi_sync_posts_folder', 'posts', '', 'no' );
}
function oribi_sync_deactivate() {