Skip to content

Fix syntax highlighting scope and embedded image caption rendering#14

Merged
driveton merged 2 commits intomainfrom
fix-syntax-highlight
Feb 24, 2026
Merged

Fix syntax highlighting scope and embedded image caption rendering#14
driveton merged 2 commits intomainfrom
fix-syntax-highlight

Conversation

@driveton
Copy link
Copy Markdown
Owner

Summary

  • data-controller="syntax-highlight" was attached to the entire .lexxy-content wrapper div, causing the Stimulus controller to affect all content including embedded images. Moved highlightCode() to turbo:load and turbo:render event listeners in application.js so code highlighting runs globally without coupling to the content wrapper. The now-unused syntax_highlight_controller.js is removed.
  • Embedded images in page content were rendering with bare caption text and no semantic markup. ActionText's _blob.html.erb already wraps images in /, but HtmlScrubber was stripping those tags since they were not in the permitted list. Added figure and figcaption to the allowed tags.

driveton added 2 commits February 24, 2026 13:59
Move highlightCode() call to turbo:load and turbo:render events in
application.js so code syntax highlighting works globally without
coupling to the lexxy-content wrapper div.
ActionText renders embedded images via _blob.html.erb which wraps them
in figure/figcaption, but HtmlScrubber was stripping those tags since
they were not in the permitted list, leaving bare img tags and
unformatted caption text.
@driveton driveton merged commit eef4a79 into main Feb 24, 2026
4 checks passed
@driveton driveton deleted the fix-syntax-highlight branch February 24, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant