Images & Media in Code Editor
Add and manage images and media files when working with code editors and Documentation.AI
Images & Media in Code Editor
Add images and media to your documentation using markdown syntax and the Documentation.AI Image component. Unlike the web editor's drag-and-drop uploads, code editors require manual file management and component syntax.
Code Editor vs Web Editor
Code Editor Approach:
- Reference external CDN URLs or upload to Documentation.AI first
- Use Image component syntax manually
- Commit image references to Git
- Organize image URLs in your content
Web Editor Approach (comparison):
- Drag-and-drop upload with automatic CDN hosting
- Visual image insertion and resizing
- Automatic optimization and
uidgeneration
Adding Images
Using Documentation.AI Image Component
The preferred method is using Documentation.AI's Image component with CDN URLs:
<Image
uid="unique-id-from-upload"
src="https://your-cdn.com/image.png"
alt="Description of the image"
width="800"
height="600"
/>
To get CDN URLs:
- Upload images via the Documentation.AI web editor first
- Copy the generated
srcanduidvalues - Use these in your MDX files
Basic Markdown Images
For simple images without advanced features:

Image Component Properties
Documentation.AI Image component supports these properties:
<Image
uid="fcb073e1-1a69-4d5b-86e8-41b52dac9802"
src="https://cdn-url.com/image.webp"
alt="Descriptive alt text for accessibility"
width="672"
height="343"
style="width: 400px; margin: 0 auto;"
priority={true}
fetchpriority="high"
/>
Key properties:
src(required) - CDN URL for the imagealt(required) - Accessibility descriptionuid- Unique identifier from Documentation.AI uploadwidth/height- Dimensions for layout optimizationstyle- CSS for alignment and sizingpriority- Load immediately (for above-fold images)
See the Image component reference for all options.
AI Coding Agents: When using Cursor, Windsurf, or other AI assistants, leverage our component prompts to generate proper Documentation.AI Image and Video component syntax with all required attributes.
Videos and Media
Video Component
Add videos using the Documentation.AI Video component:
<Video
src="https://cdn-url.com/demo-video.mp4"
poster="https://cdn-url.com/video-poster.jpg"
controls={true}
autoPlay={false}
/>
External Video Platforms
Embed videos from external platforms:
<Video
src="https://www.youtube.com/embed/VIDEO_ID"
platform="youtube"
title="API Integration Tutorial"
width="100%"
height="400"
/>
See the Videos and Iframes component reference for all options.
Workflow for Code Editors
Recommended Process
- Upload images via Documentation.AI web editor to get CDN URLs
- Copy the generated markup from web editor
- Paste into your MDX files in code editor
- Commit and push changes
Alternative: External CDNs
Host images on external CDNs and reference directly:
<Image
src="https://your-cdn.com/image.png"
alt="Description"
width="600"
height="400"
/>
Note: External images won't have Documentation.AI's automatic optimization.
Media Management Tips
Image Organization
For team workflows:
- Upload images through web editor for automatic CDN hosting
- Share CDN URLs with team members
- Keep a reference document of commonly used image URLs
- Use descriptive alt text for accessibility
Version Control
What to commit:
- MDX files with image component syntax
- Updated
documentation.jsonnavigation
What NOT to commit:
- Large image files (use CDN URLs instead)
- Temporary image assets
Performance Considerations
- Use
priority={true}only for above-fold images - Include
widthandheightto prevent layout shift - Optimize images before uploading to CDN
- Use appropriate image formats (WebP, PNG, JPG, SVG)
Next Steps
- Git Workflow: Collaborate on visual content
- Publishing: Deploy documentation with images
- Organization: Structure your project files
- Troubleshooting: Resolve image display issues
Last updated 5 days ago