Learn how to reorder, update, and add custom pages to your generated documentation.
AI Docs automates the creation of comprehensive documentation from your GitHub repositories, but it also provides robust tools for managing and refining the generated content. This ensures that your documentation remains accurate, well-organized, and perfectly tailored to your project's needs. You can easily view, edit, reorder, and group documentation pages directly within the AI Docs platform.
Once AI Docs has processed your repository and generated documentation, you can access it through the "Docs" tab on your project's dashboard. This tab presents a structured view of all generated pages.
By default, pages are ordered based on the AI's initial assessment of logical flow and importance. You can select any page from the list to view its content rendered in a clean, readable format.
AI Docs empowers you to take full control over your documentation. While the AI generates initial content, you can refine, expand, or correct any page as needed. This is particularly useful for adding specific details, clarifying complex concepts, or incorporating information that might not be directly present in the codebase.
When you edit a page, you are directly modifying its Markdown content. These changes are saved instantly and reflected in your live documentation.
API Endpoint: /api/docs/update
The /api/docs/update endpoint facilitates the real-time editing of documentation page content.
POSTid (string): The unique identifier of the documentation page to be updated.content (string): The new Markdown content for the page.content and updatedAt fields for the documentation page are updated in the database.// Example of a conceptual client-side update request
async function updateDocumentationPage(docId: string, newContent: string) {
try {
const response = await fetch('/api/docs/update', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: docId, content: newContent }),
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.error || 'Failed to update documentation');
}
console.log('Documentation page updated successfully!');
// Optionally, re-fetch the page to display updated content
} catch (error) {
console.error('Error updating documentation page:', error);
}
}
// Usage example (assuming you have the docId and new content)
// updateDocumentationPage('doc_abc123', '# My Updated Title\n\nThis is the new content of my page.');
Manual edits are persistent, but be aware that triggering a full project Regeneration will re-run the AI generation pipeline. Depending on your project settings and the nature of the changes, this process might overwrite manual edits. It's a good practice to back up significant manual changes if you plan to regenerate.
To enhance the navigability and logical flow of your documentation, AI Docs allows you to reorder pages and organize them into custom groups. This is particularly useful for creating a hierarchical structure that guides users through your project's features and concepts.
You can typically drag-and-drop pages within the "Docs" tab to change their display order. You can also assign pages to specific groups, which might appear as sections or categories in the documentation sidebar.
API Endpoint: /api/docs/reorder
The /api/docs/reorder endpoint handles the bulk updating of documentation page order and grouping.
POSTupdates (array of objects): An array where each object contains:
id (string): The unique identifier of the documentation page.order (number): The new numerical order for the page (e.g., 1, 2, 3...).group (string, optional): The new group name for the page.order and group fields for all specified pages, ensuring data consistency.// Example of a conceptual client-side reorder request
async function reorderDocumentationPages(projectId: string, pageUpdates: Array<{ id: string; order: number; group?: string }>) {
try {
const response = await fetch('/api/docs/reorder', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ updates: pageUpdates }),
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.error || 'Failed to reorder documentation pages');
}
console.log('Documentation pages reordered successfully!');
// Optionally, re-fetch the project docs to display the new order
} catch (error) {
console.error('Error reordering documentation pages:', error);
}
}
// Usage example
// const updates = [
// { id: 'doc_page_1', order: 1, group: 'Introduction' },
// { id: 'doc_page_2', order: 2, group: 'Introduction' },
// { id: 'doc_page_3', order: 1, group: 'Advanced Topics' },
// ];
// reorderDocumentationPages('project_xyz789', updates);
Beyond viewing and editing, AI Docs provides convenient tools for interacting with the content of a documentation page. These tools are typically found in a "Copy page" dropdown menu on the page itself.