Skip to content

fix: strip raw HTML <img> and <p> tags in sanitize_markdown#106

Merged
besologic merged 3 commits intomainfrom
bl/fix-sanitize-markdown-img-tags
Apr 15, 2026
Merged

fix: strip raw HTML <img> and <p> tags in sanitize_markdown#106
besologic merged 3 commits intomainfrom
bl/fix-sanitize-markdown-img-tags

Conversation

@besologic
Copy link
Copy Markdown
Contributor

Summary

Re-implementation of #73 as a fresh branch on this repo (the fork-based PR had diff rendering issues on GitHub).

  • Strip raw <img> tags in sanitize_markdown — Asana only supports Asana-hosted images with data-asana-gid attributes; external GitHub screenshot URLs cause a 400 Bad Request
  • Strip <p> open tags and convert </p> to newlines — <p> is not in Asana's supported tag list
  • Add a full describe('sanitize_markdown') test block covering the new behavior and existing transforms

Context

GitHub PR bodies can contain raw HTML — most commonly <img> tags for embedded screenshots. sanitize_markdown previously 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

  • All 304 existing tests pass
  • New sanitize_markdown tests cover <img>, <p>, and edge cases
  • bun run all clean (format, lint, test, package)

🤖 Generated with Claude Code

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>

This comment was marked as resolved.

besologic and others added 2 commits April 15, 2026 09:58
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>
@besologic besologic marked this pull request as ready for review April 15, 2026 17:02
@besologic besologic requested a review from joeltjames as a code owner April 15, 2026 17:02
@besologic besologic merged commit 755de9b into main Apr 15, 2026
3 checks passed
@besologic besologic deleted the bl/fix-sanitize-markdown-img-tags branch April 15, 2026 22:53
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.

3 participants