Skip to content

feat: support HTML content from WYSIWYG editor for job content#3397

Merged
idoshamun merged 8 commits intomainfrom
feat/wysiwyg-rich-text-editor
Jan 6, 2026
Merged

feat: support HTML content from WYSIWYG editor for job content#3397
idoshamun merged 8 commits intomainfrom
feat/wysiwyg-rich-text-editor

Conversation

@idoshamun
Copy link
Copy Markdown
Member

Summary

  • Add sanitizeHtml function to sanitize HTML from rich text editor
  • Add isHtmlContent helper to detect HTML vs markdown content
  • Update renderOpportunityContent to handle both HTML (new) and markdown (legacy)

Test plan

  • Verify new HTML content is properly sanitized
  • Verify legacy markdown content still renders correctly
  • Check that dangerous HTML tags/attributes are stripped

- Add sanitizeHtml function to sanitize HTML from rich text editor
- Add isHtmlContent to detect HTML vs markdown content
- Update renderOpportunityContent to handle both HTML and legacy markdown
- Add isomorphic-dompurify dependency for server-side HTML sanitization
@pulumi
Copy link
Copy Markdown

pulumi Bot commented Jan 5, 2026

🍹 The Update (preview) for dailydotdev/api/prod (at 2cbf386) was successful.

Resource Changes

    Name                                                   Type                           Operation
~   vpc-native-sync-subscription-with-cio-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                    kubernetes:batch/v1:CronJob    update
+-  clickhouse-sync-clickhouse-sync                        kubernetes:apps/v1:Deployment  create-replacement
+   vpc-native-api-clickhouse-migration-9335b757           kubernetes:batch/v1:Job        create
~   vpc-native-calculate-top-readers-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                           kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-update-source-public-threshold-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-updated-sync-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-recommendations-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-opportunities-cron             kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-7b6b66d7                   kubernetes:batch/v1:Job        delete
~   vpc-native-validate-active-users-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-trending-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                        kubernetes:batch/v1:CronJob    update
+-  clickhouse-sync-clickhouse-sync-config                 kubernetes:core/v1:Secret      create-replacement
~   vpc-native-post-analytics-history-day-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                  kubernetes:apps/v1:Deployment  update
~   vpc-native-personalized-digest-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-update-source-tag-view-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                          kubernetes:apps/v1:Deployment  update
~   vpc-native-hourly-notification-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-update-highlighted-views-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-gifted-plus-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment              kubernetes:apps/v1:Deployment  update
~   vpc-native-check-analytics-report-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron              kubernetes:batch/v1:CronJob    update
+   vpc-native-api-db-migration-9335b757                   kubernetes:batch/v1:Job        create
~   vpc-native-clean-zombie-user-companies-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                           kubernetes:batch/v1:CronJob    update
-   vpc-native-api-clickhouse-migration-7b6b66d7           kubernetes:batch/v1:Job        delete
~   vpc-native-temporal-deployment                         kubernetes:apps/v1:Deployment  update

Comment thread src/common/markdown.ts Outdated
*/
export const isHtmlContent = (content: string): boolean => {
// Check for common HTML tags used in rich text
return /<\/?(?:p|strong|em|ul|ol|li|a|br)[^>]*>/i.test(content);
Copy link
Copy Markdown
Contributor

@capJavert capJavert Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should match open and closing tag as well, for example <strong>whatever else I want here!!! ### .....

Think HTML content should be always wrapped in a section or parent div. Also markdown can have mix of html links and images, for example github allows <img /> tag. We don't have to support it but somebody pasting markdown from github to us could false detect.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but i think in this case, it's better to be stricter and to think it's html then the opposite. but actually when thinking about it, i don't even need this function. i need to support only html. we don't need backwards compatibility

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was also gonna say since there's no active users and we store html we don't need backward compat.

Copy link
Copy Markdown
Contributor

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nth: remove the markdown all together for this purpose.

Comment thread src/common/markdown.ts Outdated
ALLOWED_ATTR: ['href', 'target', 'rel'],
// Force all links to open in new tab with nofollow
ADD_ATTR: ['target', 'rel'],
}).replace(/<a /g, '<a target="_blank" rel="noopener nofollow" ');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this add double target/rel if that already exists?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. fixed it

Comment thread src/schema/opportunity.ts Outdated
* Renders content for opportunity fields
* Handles both HTML (from WYSIWYG editor) and markdown (legacy) content
* - If content contains HTML tags, sanitizes it directly
* - If content is markdown (legacy), converts to HTML
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to support imo

@idoshamun
Copy link
Copy Markdown
Member Author

@claude we don't need to the markdown support for this feature anymore, so you can remove it from here

@claude
Copy link
Copy Markdown

claude Bot commented Jan 6, 2026

Claude finished @idoshamun's task in 1m 48s —— View job


Completed removing markdown support

  • Read current implementation
  • Remove isHtmlContent helper function
  • Simplify renderOpportunityContent to only handle HTML
  • Commit and push changes

Changes made

I've removed the markdown support from the opportunity content feature:

  1. Removed isHtmlContent function from src/common/markdown.ts:28-31 - This helper is no longer needed since we're not detecting content type anymore.

  2. Simplified renderOpportunityContent function in src/schema/opportunity.ts:1057-1080:

    • Removed the conditional logic that checked if content was HTML or markdown
    • Now only uses sanitizeHtml() to process all content
    • Updated the function documentation to reflect HTML-only support
  3. Cleaned up imports in src/schema/opportunity.ts:68:

    • Removed unused markdown and isHtmlContent imports
    • Only kept sanitizeHtml which is the only function needed now

The changes have been committed and pushed to the branch. The feature now only supports HTML content from the WYSIWYG editor without any backward compatibility for markdown.

--- | Branch

github-actions Bot and others added 5 commits January 6, 2026 08:52
Remove isHtmlContent helper and markdown fallback from renderOpportunityContent since backward compatibility is not needed. Only HTML content from WYSIWYG editor is supported now.

Co-authored-by: Ido Shamun <idoshamun@users.noreply.github.com>
@idoshamun idoshamun merged commit 7152da4 into main Jan 6, 2026
10 checks passed
@idoshamun idoshamun deleted the feat/wysiwyg-rich-text-editor branch January 6, 2026 09:57
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