Prompt Button Feature
A new feature that adds an AI-optimized "Prompt" button next to the Copy button, allowing users to export documentation content as prompts specifically formatted for Cursor AI, ChatGPT, Google Gemini, or any AI assistant.
Features
- Platform-Specific Formatting - Optimized output for Cursor, ChatGPT, Gemini, or Universal AI
- Context-Rich Output - Includes page metadata, category, tool info, and source URL
- Smart Content Extraction - Preserves code blocks, tables, lists, and formatting
- Analytics Tracking - Tracks which platforms are most used
- Visual Distinction - Purple/AI-themed styling separate from Copy button
- Dropdown Interface - Clean 4-option dropdown menu
- Responsive Design - Works on mobile and desktop
- Accessibility - Proper ARIA attributes and keyboard navigation
How It Works
The Prompt button appears automatically on all documentation pages next to the existing Copy button. It uses platform-specific formatters to optimize content for AI consumption.
User Experience
- Click the "Prompt" button (purple icon with sparkles) next to breadcrumbs
- Select your AI platform from the dropdown:
- Cursor AI - Optimized for Cursor with file paths and tool context
- ChatGPT - Conversational format with expanded links
- Gemini - Structured data format for Google's AI
- Universal - Clean markdown for any AI assistant
- Content is copied to clipboard in AI-optimized format
- Paste into your AI assistant and start working!
Visual Feedback
- Button shows "Copied!" message for 2 seconds after copying
- Dropdown closes automatically after selection
- Purple hover state indicates AI-focused feature
- Button includes hover and focus states for better UX
Platform-Specific Formatting
Cursor AI Format
Optimized for Cursor with:
- File path references and code structure
- Tool-specific context from frontmatter
- Links to related tool documentation
- Helpful Cursor-specific context footer
- References to workspace structure
Example output structure:
# Tool Documentation: Webflow
Category: Website Tools
Monthly Cost: £25.00 GBP
Last Updated: 2026-01-07
Source: https://docs.pacing.agency/tools/webflow
## Context for Cursor
This is internal documentation for Pacing Agency's Webflow setup...
## Documentation Content
[Full content with preserved formatting]
## Helpful Context for Cursor
- Workspace: Main tech stack repository
- Related Files: tools/, architecture.md
- Tool Documentation: tools/webflow.md
ChatGPT Format
Optimized for conversational AI with:
- Friendly conversational intro
- Expanded relative links to full URLs
- Clear section headings
- Context about how to use the information
Example output structure:
# Documentation: Webflow
Hi! I'm sharing documentation from Pacing Agency's internal tech stack...
## Quick Reference
- Category: Tools
- Tool Name: Webflow
[metadata...]
## How to Use This Information
This documentation includes configuration details...
## Full Documentation
[Content with all links expanded to full URLs]
Gemini Format
Optimized for Google Gemini with:
- Structured YAML frontmatter
- Categorized metadata
- Clean sectioned content
- Additional context footer
Example output structure:
---
type: technical_documentation
source: pacing_agency_tech_stack
title: Webflow
category: Tools
tool_category: Website
---
# Webflow
## Document Summary
**Purpose**: Internal technical documentation...
## Key Information
[Structured metadata]
## Documentation Content
[Full content]
## Additional Context
- Organization: Pacing Agency
[...]
Universal Format
Clean markdown for maximum compatibility:
- Simple blockquote metadata
- Minimal formatting
- No platform-specific optimizations
- Works with any AI assistant
Technical Implementation
Component Structure
docusaurus/src/components/PromptButton/
├── index.tsx # Main component
├── styles.module.css # Purple/AI themed styling
└── formatters.ts # Platform-specific formatters
Platform Formatters
The formatters.ts file contains 4 formatting functions:
export function formatForCursor(options: FormatterOptions): string
export function formatForChatGPT(options: FormatterOptions): string
export function formatForGemini(options: FormatterOptions): string
export function formatUniversal(options: FormatterOptions): string
Each formatter receives:
- content: Markdown content from page
- metadata: Page metadata (title, category, tool info, costs, etc.)
- rawMarkdown: Optional raw markdown source
Metadata Extraction
The component automatically extracts metadata from:
- Docusaurus page context (useActiveDocContext)
- Tool frontmatter (category, costs, account type)
- URL path (for category detection)
- Document title and structure
interface PageMetadata {
title: string;
category: string;
toolCategory?: string;
toolName?: string;
lastUpdated?: string;
monthlyCost?: number;
accountType?: string[];
source: string;
}
Integration
The PromptButton is automatically injected into all documentation pages via the DocItem wrapper:
// docusaurus/src/theme/DocItem/index.tsx
import PromptButton from '@site/src/components/PromptButton';
export default function DocItemWrapper(props: Props): ReactNode {
return (
<>
<div className="copy-download-button-container">
<CopyDownloadButton />
<PromptButton />
</div>
<DocItem {...props} />
</>
);
}
Styling
Purple/AI-themed styling with:
- Purple border and hover states (rgb(139, 92, 246))
- Distinct visual identity from Copy button
- Dark mode support with adjusted colors
- Smooth animations and transitions
- Shadow with purple tint on dropdown
Analytics Tracking
The component tracks usage via Google Analytics (when analytics is implemented):
window.dataLayer.push({
event: 'prompt_action',
platform: 'cursor|chatgpt|gemini|universal',
page_title: document.title,
content_length: formattedContent.length
});
This allows us to understand:
- Which AI platforms are most popular
- What content is being exported as prompts
- How the feature is being used
Usage Examples
Example 1: Exporting Tool Documentation for Cursor
- Navigate to
/tools/webflow - Click "Prompt" button
- Select "Cursor AI"
- Paste into Cursor chat
- Ask: "Help me set up a new Webflow project based on this documentation"
Example 2: Sharing Guide with ChatGPT
- Navigate to
/Guides/gtm-setup - Click "Prompt" button
- Select "ChatGPT"
- Paste into ChatGPT
- Ask: "Walk me through implementing this GTM setup for a new client"
Example 3: Using Architecture Docs with Gemini
- Navigate to
/architecture - Click "Prompt" button
- Select "Gemini"
- Paste into Google AI
- Ask: "Analyze this architecture and suggest improvements"
Setup Guide
For New Repositories
-
Copy component files:
docusaurus/src/components/PromptButton/index.tsxdocusaurus/src/components/PromptButton/styles.module.cssdocusaurus/src/components/PromptButton/formatters.ts
-
Update DocItem wrapper:
import PromptButton from '@site/src/components/PromptButton';
// Add to render:
<div className="copy-download-button-container">
<CopyDownloadButton />
<PromptButton />
</div> -
Test the feature:
- Start dev server:
npm start - Navigate to any documentation page
- Verify button appears next to Copy button
- Test all 4 platform options
- Start dev server:
Customization
Button Text
Change button text in index.tsx:
<span className={styles.buttonText}>Prompt</span>
// Change to: "AI", "Export", "Optimize", etc.
Button Colors
Modify purple theme in styles.module.css:
.promptButton {
border: 1px solid rgba(139, 92, 246, 0.3); /* Change color here */
}
Formatter Customization
Add custom context or modify formatting in formatters.ts:
export function formatForCursor(options: FormatterOptions): string {
// Add your custom context or formatting
formatted += `## Custom Section\n\n`;
formatted += `Your custom content here\n\n`;
return formatted;
}
Platform Icons
Update SVG icons in index.tsx dropdown items to change visual appearance.
Best Practices
When to Use Each Platform
Cursor AI:
- When working in Cursor editor
- Need file path references
- Building/modifying code
- Understanding tool integrations
ChatGPT:
- General questions about documentation
- Need conversational explanations
- Want expanded context
- Creating content based on docs
Gemini:
- Complex analysis tasks
- Structured data processing
- Multi-step workflows
- Google Workspace integration
Universal:
- Any other AI assistant (Claude, etc.)
- Maximum compatibility needed
- Simple markdown preferred
- Custom AI tools
Content Optimization Tips
- Select specific pages - Don't export entire site, focus on relevant pages
- Combine with questions - After pasting, ask specific questions
- Reference multiple pages - Export 2-3 related pages for complete context
- Update regularly - Re-export when documentation is updated
- Use with code - Combine documentation export with code snippets
Limitations
1. Content Extraction
- May not perfectly preserve all MDX components
- Complex nested structures might simplify
- Dynamic content is not captured
- Images are referenced by URL (not embedded)
2. Length Limits
- Some AI platforms have context length limits
- Long pages may need to be split
- Code blocks count toward token limits
- Consider exporting specific sections for very long docs
3. Platform Variations
- Each AI platform interprets markdown differently
- Some formatting may not translate perfectly
- Links may need to be manually clicked
- Tables might render differently
Troubleshooting
Button Not Appearing
Issue: Prompt button doesn't show on page
Solutions:
- Check DocItem wrapper includes PromptButton import
- Verify component files are in correct location
- Clear browser cache and restart dev server
- Check browser console for errors
Copy Not Working
Issue: Nothing copied to clipboard when clicking
Solutions:
- Check browser supports Clipboard API (modern browsers only)
- Try HTTPS (required for clipboard access)
- Check browser console for permission errors
- Test in different browser
Formatting Issues
Issue: Output format doesn't look right in AI
Solutions:
- Try a different platform format
- Check if AI platform has markdown rendering issues
- Use Universal format for clean markdown
- Manually adjust formatting after paste
Missing Metadata
Issue: Tool costs or categories not appearing
Solutions:
- Verify frontmatter in source tool doc
- Check metadata extraction in component
- Test on page with known good metadata
- Review page context in browser DevTools
Related Documentation
- Copy/Download Button - Original copy feature
- Tool Categorization - How tool metadata works
- ToolMetadata Component - Metadata display on tool pages
- Docusaurus Overview - Full feature list
- Repository Structure - Project organisation
Future Enhancements
Potential improvements for this feature:
- Image Embedding - Include base64-encoded images in prompt
- Section Selection - Allow user to select specific sections to export
- History - Save recent prompts for quick re-export
- Custom Templates - User-defined prompt templates
- Batch Export - Export multiple related pages at once
- AI Response Integration - Paste AI response back into docs
- Prompt Library - Pre-built prompts for common tasks
- Version Comparison - Export diffs between versions
Contributing
Found a way to improve the formatters? Have a new platform to add?
- Modify
formatters.tswith your changes - Test thoroughly with real AI platforms
- Update this documentation
- Share with the team for feedback
Status: ✅ Production-ready
Last Updated: 2026-01-07
Tested With: Cursor AI, ChatGPT 4, Google Gemini
Browser Support: All modern browsers with Clipboard API