Core Rendering Components Overview
The Osirion.Blazor Core Rendering module provides powerful components for dynamic content rendering and HTML processing. These components enable safe, flexible display of user-generated content and dynamic markup within Blazor applications.
Available Components
HTML Renderer
A secure HTML rendering component that safely displays HTML content while preventing XSS attacks and maintaining application security. Perfect for rendering user-generated content, markdown output, and dynamic HTML from external sources.
Key Features
- Security First: Built-in XSS protection and content sanitization
- Flexible Rendering: Support for various HTML content types
- Performance Optimized: Efficient rendering with minimal overhead
- Customizable Sanitization: Configurable HTML filtering rules
- CSS Integration: Seamless styling and theme integration
Getting Started
To use rendering components in your project:
@using Osirion.Blazor.Core
<HtmlRenderer Content="@htmlContent"
SanitizationLevel="@SanitizationLevel.Strict"
AllowedTags="@allowedTags"
AllowedAttributes="@allowedAttributes" />
Security Features
The HTML Renderer provides comprehensive security:
- XSS Prevention: Automatic script injection protection
- Content Sanitization: Whitelist-based HTML filtering
- Attribute Validation: Safe attribute handling and validation
- URL Filtering: Protection against malicious links
- Custom Rules: Configurable security policies
Sanitization Levels
Multiple security levels available:
- Strict: Maximum security with minimal HTML allowed
- Standard: Balanced security for typical content
- Relaxed: More permissive for trusted content sources
- Custom: User-defined sanitization rules
Content Sources
Ideal for rendering content from:
- Content Management Systems: CMS-generated HTML content
- Markdown Processors: Converted markdown to HTML
- User Comments: Safely display user-generated content
- External APIs: Third-party content integration
- Rich Text Editors: WYSIWYG editor output
Configuration Options
Extensive customization capabilities:
- Tag Whitelist: Define allowed HTML elements
- Attribute Control: Specify permitted attributes per tag
- CSS Handling: Style and class attribute management
- Link Policies: External link handling and security
- Image Processing: Safe image source validation
Performance Considerations
The HTML Renderer is optimized for:
- Minimal Processing: Efficient content parsing and rendering
- Caching Support: Rendered content caching capabilities
- Memory Efficiency: Low memory footprint for large content
- Server-Side Rendering: Full SSR compatibility
This rendering component ensures that your application can safely display dynamic HTML content while maintaining security and performance standards.
