Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/shamela/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Sanitizes page content by applying regex-based replacement rules tuned for Shamela sources. This function normalizes Arabic text and removes common artifacts from the Shamela export format.Signature
Parameters
The text to clean
Optional custom replacement rules as regex pattern/replacement pairs. Defaults to
DEFAULT_MAPPING_RULES which includes:- Footnote marker removal
- Arabic character normalization
- Whitespace cleanup
- Diacritical mark processing
Returns
The sanitized content with all rules applied
Example
Custom Rules
You can extend the default rules with custom mappings:Performance
- Rules are compiled into RegExp objects and cached for reuse
- Default rules are pre-compiled for optimal performance
- Custom rules are compiled on first use
Related Functions
removeArabicNumericPageMarkers()- Remove specific page markerssplitPageBodyFromFooter()- Separate footnotes from body