---
title: "Discussion on \"Rich text in Arabic portals: paste, sanitize and render\" | Hashnode"
description: "Discussion on \"Rich text in Arabic portals: paste, sanitize and render\". A restricted content policy for Arabic-English notes, from pasted documents and server validation to links, direction and every saved view."
url: "https://hashnode.com/posts/rich-text-arabic-portals-paste-sanitize-render/6aef082a4525742078de46de"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Rich text in Arabic portals: paste, sanitize and render](https://www.sultanbyte.com/rich-text-arabic-portals-paste-sanitize-render?utm_source=hashnode&utm_medium=feed)

A restricted content policy for Arabic-English notes, from pasted documents and server validation to links, direction and every saved view.

Nov 7 · 9 min read · sultanbyte.com  
Read the article

-   [#security](https://hashnode.com/tag/security)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Hussain Fakhruddin](https://hashnode.com/@hussainanjar)

@hussainanjar · Dubai, UAE

  
[View profile](https://hashnode.com/@hussainanjar)

Founder & CTO Qualascend.com | Staticforms.dev

I have lead the Engineering for multiple startups in UAE. I also have my own agency qualascend.com.

## Responses 2

Markdown supported · ⌘↵ to post

[mizab chohan](https://hashnode.com/@kuwait-career-guide)

[Nov 7](https://hashnode.com/posts/rich-text-arabic-portals-paste-sanitize-render/6aef082a4525742078de46de/comment/6aef3cfebd4ad8233da4d808)

The idea of treating pasted content as an import rather than simply accepting the clipboard HTML is really important. I also think testing the same saved note across different views is essential, because formatting that looks correct in an editor may not behave the same way in emails or exported documents. The acceptance tests make this approach much more practical for developers. Great technical breakdown!

[OneLifeVibe](https://hashnode.com/@onelifevibe)

[Nov 7](https://hashnode.com/posts/rich-text-arabic-portals-paste-sanitize-render/6aef082a4525742078de46de/comment/6aef37393bebc514375d3ed4)

The point about direction surviving sanitization is the one most guides skip — stripping attributes feels safe until an Arabic note with an English equipment code and parentheses renders backwards and the meaning changes. Treating paste as an import into a document model, rather than a clipboard dump, is also the right framing; the contenteditable default of keeping formatting is exactly how stray styles and direction markup leak in. I liked the fixture set at the end, especially reopening saved fixtures after a sanitizer or parser update — that is the check teams forget, and it is where a previously safe note quietly starts rendering differently. One thing I would add: the renderer inventory is worth extending to exported views too, like PDFs or emailed copies, since those often bypass the sanitized path entirely.
