fix: strip raw HTML <img> and <p> tags in sanitize_markdown#106
Merged
fix: strip raw HTML <img> and <p> tags in sanitize_markdown#106
Conversation
GitHub PR bodies can contain raw HTML tags (e.g. screenshot embeds as <img> tags) that pass through sanitize_markdown unchanged. When sent to Asana's html_notes field, unsupported tags cause a 400 Bad Request. - Strip <img> tags entirely — Asana only supports Asana-hosted images with data-asana-gid attributes; external GitHub screenshot URLs are always rejected - Strip <p> open tags and convert </p> to newlines — <p> is not in Asana's supported tag list (use literal newlines instead) - Add sanitize_markdown test block covering new and existing transforms Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevents false matches on tags like <pre>, <picture>, <param>, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensures the <p> stripping regex doesn't false-match on <pre> tags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
joeltjames
approved these changes
Apr 15, 2026
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
Re-implementation of #73 as a fresh branch on this repo (the fork-based PR had diff rendering issues on GitHub).
<img>tags insanitize_markdown— Asana only supports Asana-hosted images withdata-asana-gidattributes; external GitHub screenshot URLs cause a400 Bad Request<p>open tags and convert</p>to newlines —<p>is not in Asana's supported tag listdescribe('sanitize_markdown')test block covering the new behavior and existing transformsContext
GitHub PR bodies can contain raw HTML — most commonly
<img>tags for embedded screenshots.sanitize_markdownpreviously stripped markdown-syntax images but passed raw HTML<img>tags through unchanged, causing Asana API 400 errors.Verified fix against: https://github.com/planningcenter/people/pull/14325
Supersedes #73.
Test plan
sanitize_markdowntests cover<img>,<p>, and edge casesbun run allclean (format, lint, test, package)🤖 Generated with Claude Code