Add syntax highlighting to SQL editor and output panels#214
Conversation
- Add Highlight.js (CDN) for SQL input, JSON output, and Python output - SQL input uses transparent textarea overlaid on highlighted pre element for live syntax highlighting while typing (works on mobile and desktop) - JSON and Python output panels use Highlight.js for colored output - Wrap page in max-width: 1200px container to prevent excessive width - Reduce pprint indentation from width=60 to width=80, indent=1 https://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
|
Claude finished @simonw's task —— View job Code Review Complete ✅I've reviewed the syntax highlighting implementation for the SQLite AST Explorer. Here's my comprehensive feedback: Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is good overall. ✅ Strengths
|
hljs.highlightElement() sets data-highlighted and skips the element on subsequent calls. Need to remove that attribute before each re-highlight, matching what highlightOutput() already does. https://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
Deploying tools with
|
| Latest commit: |
3a99ff0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://81c3222d.tools-b1q.pages.dev |
| Branch Preview URL: | https://claude-add-syntax-highlighti.tools-b1q.pages.dev |
|
Claude finished @simonw's task —— View job Code Review Complete ✅Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is good overall. ✅ Strengths
|
- Install rich in parallel with sqlite-ast via micropip - Use pretty_repr(ast, max_width=88, indent_size=2, expand_all=True) for cleaner, more readable dataclass output - Update column header label from "pprint" to "rich" https://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
|
Claude finished @simonw's task —— View job Code Review Complete ✅Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is good overall. ✅ Strengths
|
|
Claude finished @simonw's task —— View job Code Review Complete ✅Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is good overall. ✅ Strengths
|
await a, b creates a tuple and only awaits the first coroutine. Use asyncio.gather() to actually run both installs concurrently. https://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
|
Claude finished @simonw's task —— View job Code Review Complete ✅Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is good overall. ✅ Strengths
|
|
I figured out Rich pretty printing using ChatGPT: https://chatgpt.com/share/697e113e-20ac-8006-9bef-ab3fd727d7e6 |
The pre/code behind the textarea is purely visual — screen readers should only see the textarea itself. https://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
|
Claude finished @simonw's task —— View job Code Review Complete ✅Todo List:
🎯 Overall AssessmentThis is a well-implemented syntax highlighting enhancement that significantly improves the user experience. The overlay approach for real-time highlighting is clever and the code quality is generally good. However, there are some important security and code quality issues that should be addressed. ✅ Strengths
|
Summary
Enhanced the SQLite AST Explorer with syntax highlighting for the SQL input editor and JSON/Python output panels using Highlight.js. Implemented a synchronized code editor with a transparent textarea overlay for a better user experience.
Key Changes
<code>elements within<pre>tags for consistent highlighting.page-wrappercontainer with max-width constraint for better content presentationImplementation Details
<pre><code>blockcolor: transparentand-webkit-text-fill-color: transparentwhile maintaining visible carethttps://claude.ai/code/session_011up4NZEATLYrzv6vN3rLif
https://gisthost.github.io/?b44f4226844f482738a8da7700c6473b/index.html