requireAuth(); header('Content-Type: application/json'); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $input = json_decode(file_get_contents('php://input'), true); $markdown = $input['markdown'] ?? $_POST['markdown'] ?? ''; if (empty($markdown)) { http_response_code(400); echo json_encode(['error' => 'No markdown content provided']); exit; } // You can add additional processing or sanitization here if needed // For now, we're just passing through the markdown (conversion happens client-side) echo json_encode([ 'html' => $markdown, 'processed_by' => $user['name'] ?? $user['preferred_username'] ?? 'Unknown User' ]); } else { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); }