← Back to PRs

#20816: fix(export-session): prevent Prettier from corrupting template placeholders

by boris721 open 2026-02-19 10:02 View on GitHub →
size: XS
## Problem The `/export-session` command generates HTML files with broken `<script>` tags. Instead of containing the actual JavaScript libraries (marked.js, highlight.js), the exported files contain literal placeholder text: ```html <script> { { MARKED_JS; } } </script> ``` ## Root Cause Prettier reformatted the template placeholders `{{MARKED_JS}}`, `{{HIGHLIGHT_JS}}`, and `{{JS}}` inside `<script>` tags, interpreting them as JavaScript object literals. It added whitespace and semicolons, breaking the string replacement in `generateHtml()`: ```typescript .replace("{{MARKED_JS}}", markedJs) // Looking for '{{MARKED_JS}}' // But template contains '{ { MARKED_JS; } }' ``` ## Fix Add `<!-- prettier-ignore -->` comments before each script tag to preserve the exact placeholder syntax: ```html <!-- prettier-ignore --> <script>{{MARKED_JS}}</script> ``` ## Testing Tested locally - exported HTML now contains the actual library code and renders correctly. <!-- greptile_comment --> <h3>Greptile Summary</h3> Fixed `/export-session` command generating broken HTML files by adding `<!-- prettier-ignore -->` comments before script tags containing template placeholders (`{{MARKED_JS}}`, `{{HIGHLIGHT_JS}}`, `{{JS}}`). - Prettier was reformatting these placeholders as JavaScript object literals, adding whitespace and semicolons - This broke the string replacement in `generateHtml()` at `src/auto-reply/reply/commands-export-session.ts:96-97` - The fix preserves exact placeholder syntax so template replacement works correctly - CHANGELOG entry properly documents the fix <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The fix is focused, well-tested, and addresses a clear formatting bug with a standard Prettier directive. The changes are minimal (adding three `<!-- prettier-ignore -->` comments), the root cause is well-documented, and the solution is the idiomatic approach for preventing Prettier from reformatting specific code blocks - No files require special attention <sub>Last reviewed commit: a20271c</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs