|
1 | | -# LLMs.txt Feature Documentation |
| 1 | +# Markdown Export Feature Documentation |
2 | 2 |
|
3 | | -## Overview |
| 3 | +This feature allows converting any page on the Sentry documentation site to a plain markdown format by simply appending `.md` to the end of any URL (without a trailing slash). The feature extracts the actual page content from the source MDX files and converts it to clean markdown, making the documentation more accessible to Large Language Models and other tools. |
4 | 4 |
|
5 | | -This feature allows converting any page on the Sentry documentation site to a plain markdown format by simply appending `llms.txt` to the end of any URL. The feature extracts the actual page content from the source MDX files and converts it to clean markdown, making the documentation more accessible to Large Language Models (LLMs) and other automated tools. |
| 5 | +## Example URLs |
| 6 | + |
| 7 | +- Markdown Export: https://docs.sentry.io/platforms/javascript/guides/react/user-feedback.md |
| 8 | +- Markdown Export: https://docs.sentry.io/platforms/javascript/guides/nextjs/user-feedback.md |
| 9 | +- Markdown Export: https://docs.sentry.io/platforms/javascript/guides/react/tracing.md |
| 10 | + |
| 11 | +## How it works |
| 12 | + |
| 13 | +- URL: /platforms/javascript/guides/react/user-feedback.md |
| 14 | +- Rewrite: /api/md-export/platforms/javascript/guides/react/user-feedback |
| 15 | + |
| 16 | +## Example usage |
| 17 | + |
| 18 | +``` |
| 19 | +curl "http://localhost:3000/platforms/javascript/guides/react/user-feedback.md" |
| 20 | +curl "http://localhost:3000/platforms/javascript/guides/nextjs/user-feedback.md" |
| 21 | +curl "http://localhost:3000/platforms/javascript/guides/react/tracing.md" |
| 22 | +curl "http://localhost:3000/platforms/javascript/guides/vue/user-feedback.md" |
| 23 | +``` |
6 | 24 |
|
7 | 25 | ## ✅ **Feature Status: FULLY WORKING** |
8 | 26 |
|
@@ -112,128 +130,4 @@ yarn add @sentry/react |
112 | 130 |
|
113 | 131 | ```bash {tabTitle:pnpm} |
114 | 132 | pnpm add @sentry/react |
115 | | -``` |
116 | | -``` |
117 | | -
|
118 | | -## Smart Content Processing |
119 | | -
|
120 | | -### Enhanced JSX Component Handling |
121 | | -- **Alert components** → `> **Note:** [content]` |
122 | | -- **PlatformIdentifier** → `` `traces-sample-rate` `` |
123 | | -- **PlatformLink** → `[Link Text](/path/to/page)` |
124 | | -- **PlatformContent includes** → **Actual platform-specific content loaded from files** |
125 | | -- **Code block preservation** → All existing markdown code blocks preserved |
126 | | -- **Nested components** → Multi-pass processing ensures complete cleanup |
127 | | -
|
128 | | -### Content Preservation Technology |
129 | | -- ✅ **Code Block Protection**: Temporarily replaces code blocks during JSX cleanup |
130 | | -- ✅ **Include Resolution**: Loads real content from platform-includes directory |
131 | | -- ✅ **Platform Awareness**: Automatically detects platform/guide from URL path |
132 | | -- ✅ **Smart Fallbacks**: Graceful degradation when includes aren't found |
133 | | -- ✅ **Content Reconstruction**: Restores protected content after cleanup |
134 | | -
|
135 | | -## Response Format with Code Snippets |
136 | | -
|
137 | | -```markdown |
138 | | -# Set Up User Feedback |
139 | | -
|
140 | | -The User Feedback feature allows you to collect user feedback from anywhere inside your application at any time. |
141 | | -
|
142 | | -> **Note:** |
143 | | -If you're using a self-hosted Sentry instance, you'll need to be on version 24.4.2 or higher. |
144 | | -
|
145 | | -### Installation |
146 | | -
|
147 | | -The User Feedback integration is **already included** with the React SDK package. |
148 | | -
|
149 | | -```bash {tabTitle:npm} |
150 | | -npm install @sentry/react --save |
151 | | -``` |
152 | | - |
153 | | -```bash {tabTitle:yarn} |
154 | | -yarn add @sentry/react |
155 | | -``` |
156 | | - |
157 | | -```bash {tabTitle:pnpm} |
158 | | -pnpm add @sentry/react |
159 | | -``` |
160 | | - |
161 | | -### Set Up |
162 | | - |
163 | | -```javascript |
164 | | -Sentry.init({ |
165 | | - dsn: "___PUBLIC_DSN___", |
166 | | - |
167 | | - integrations: [ |
168 | | - Sentry.feedbackIntegration({ |
169 | | - colorScheme: "system", |
170 | | - }), |
171 | | - ], |
172 | | -}); |
173 | | -``` |
174 | | - |
175 | | ---- |
176 | | - |
177 | | -**Original URL**: https://docs.sentry.io/platforms/javascript/guides/react/user-feedback |
178 | | -**Generated**: 2025-06-10T22:25:15.123Z |
179 | | - |
180 | | -*This is the full page content converted to markdown format.* |
181 | | -``` |
182 | | -
|
183 | | -## Technical Implementation |
184 | | -
|
185 | | -### Enhanced API Route Features |
186 | | -```typescript |
187 | | -// New async function for include resolution |
188 | | -async function resolvePlatformIncludes(content: string, pathSegments: string[]): Promise<string> { |
189 | | - // Platform detection from URL segments |
190 | | - // File loading from platform-includes/ |
191 | | - // Content replacement with error handling |
192 | | -} |
193 | | -
|
194 | | -// Code block preservation during cleanup |
195 | | -cleaned = cleaned.replace(/```[\s\S]*?```/g, (match) => { |
196 | | - codeBlocks.push(match); |
197 | | - return `${codeBlockPlaceholder}${codeBlocks.length - 1}`; |
198 | | -}); |
199 | | -``` |
200 | | - |
201 | | -### File System Integration |
202 | | -- **Direct file access** to `platform-includes/` directory |
203 | | -- **Gray-matter parsing** for include files |
204 | | -- **Multi-path resolution** with intelligent fallbacks |
205 | | -- **Error handling** with descriptive placeholders |
206 | | - |
207 | | -## Benefits |
208 | | - |
209 | | -✅ **Complete Content**: Extracts actual page content AND code snippets |
210 | | -✅ **Platform-Specific**: Shows correct installation/setup for each framework |
211 | | -✅ **LLM-Optimized**: Clean markdown format perfect for AI processing |
212 | | -✅ **Smart Conversion**: JSX components converted to appropriate markdown |
213 | | -✅ **Code Preservation**: All code blocks and snippets properly maintained |
214 | | -✅ **Universal Access**: Works with any documentation page |
215 | | -✅ **High Performance**: Cached responses with efficient processing |
216 | | -✅ **Error Resilient**: Graceful fallbacks and informative error messages |
217 | | - |
218 | | -## Testing Commands |
219 | | - |
220 | | -```bash |
221 | | -# Test React user feedback with full code snippets |
222 | | -curl "http://localhost:3000/platforms/javascript/guides/react/user-feedback/llms.txt" |
223 | | - |
224 | | -# Test Next.js-specific installation (shows wizard command) |
225 | | -curl "http://localhost:3000/platforms/javascript/guides/nextjs/user-feedback/llms.txt" |
226 | | - |
227 | | -# Test React tracing with platform-specific content |
228 | | -curl "http://localhost:3000/platforms/javascript/guides/react/tracing/llms.txt" |
229 | | - |
230 | | -# Test Vue.js user feedback (different platform) |
231 | | -curl "http://localhost:3000/platforms/javascript/guides/vue/user-feedback/llms.txt" |
232 | | -``` |
233 | | - |
234 | | ---- |
235 | | - |
236 | | -**Status**: ✅ **PRODUCTION READY WITH FULL CODE SNIPPETS** |
237 | | -**Last Updated**: December 2024 |
238 | | -**Content Quality**: Full page content with platform-specific code examples |
239 | | -**Code Coverage**: Installation, setup, configuration, and API examples all included |
| 133 | +``` |
0 commit comments