Conversation
…xt attachments An LLM using the CLI created a card with markdown content that included a backtick-wrapped `<action-text-attachment>` tag. Since the CLI sent content as-is, Action Text parsed the literal tag as a real attachment, triggering Mention::CreateJob and causing errors. The fix runs all card descriptions and comment bodies through goldmark (markdown-to-HTML) before sending. This converts backtick-wrapped HTML tags into escaped `<code>` blocks while passing through raw HTML unchanged, so real attachments continue to work. Also fixes parseAttachments to handle <figure> blocks that appear after the closing </action-text-attachment> tag (caused by goldmark wrapping bare attachment tags in <p>).
Goldmark doesn't convert backtick code spans inside HTML blocks, so backtick-wrapped <action-text-attachment> tags in mixed HTML/markdown pass through as raw HTML. Add a post-processing step to escape any attachment tags that remain wrapped in literal backticks. Also adds an e2e test for the combined case: a real attachment alongside backtick-wrapped example attachment tags in the same description.
- TestMarkdownToHTML: 7 tests covering backtick escaping, raw HTML passthrough, mixed content, and real alongside backtick attachments - TestParseAttachments: add case for figure block outside attachment tags (p-wrapped HTML from markdown conversion) - Update TestCommentCreate to expect markdown-converted body
Plain text without HTML tags or markdown syntax (backticks, angle brackets) should pass through unchanged to avoid wrapping simple text in unnecessary <p> tags. Adds unit test verifying plain text passthrough and reverts the comment test expectation back to plain text.
c05232e to
9c89d4b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<action-text-attachment>tag (as documentation about how attachments work). Since the CLI sent content as-is, Action Text parsed the literal tag as a real attachment, creating spurious mentions and causingMention::CreateJoberrors.<code>blocks while passing through raw HTML unchanged so real attachments continue to work.parseAttachmentsto handle<figure>blocks that appear outside the</action-text-attachment>closing tag (caused by goldmark wrapping bare attachment tags in<p>), which was a pre-existing test failure.Changes
internal/commands/markdown.go— NewmarkdownToHTML()function with goldmark conversion and post-processing for backtick-wrapped attachment tags in HTML blocksinternal/commands/card.go— Card create/update descriptions run throughmarkdownToHTML()internal/commands/comment.go— Comment create/update bodies run throughmarkdownToHTML()internal/commands/attachment.go— UpdatedparseAttachmentsregex to capture trailing<figure>blocksinternal/commands/markdown_test.go— 8 unit tests covering all conversion scenariosinternal/commands/attachment_test.go— Unit test for figure-outside-attachment parsinge2e/tests/markdown_sanitization_test.go— 5 e2e tests: backtick escaping (card + comment), real attachments still work (card + comment), and mixed real + backtick in same description