Markdown Viewer
The Markdown Viewer component renders markdown content with beautiful typography, syntax highlighting, and automatic styling.
Installation
Add the markdown viewer component to your project:
Usage
Basic Markdown
Loading preview...
Failed to load preview
Code
Headings
Loading preview...
Failed to load preview
Code
Text Formatting
Loading preview...
Failed to load preview
Code
Lists
Loading preview...
Failed to load preview
Code
Code Blocks
Loading preview...
Failed to load preview
Code
Blockquotes
Loading preview...
Failed to load preview
Code
Links
Loading preview...
Failed to load preview
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
content |
string |
'' |
The markdown content to render. Can be passed as a prop or as slot content. |
maxHeight |
string |
'420px' |
Maximum height of the content area with overflow scroll. |
Examples
Using Content Prop
<x-ui.markdown-viewer :content="$markdownContent" />
Using Slot Content
```blade <x-ui.markdown-viewer> # Your Title
Your **markdown** content here...
</x-ui.>
Custom Height
```blade <x-ui.markdown-viewer maxHeight="600px"> # Long Content
This content can be up to 600px tall before scrolling...
</x-ui.>
Custom Styling
```blade <x-ui.markdown-viewer class="shadow-lg"> # Styled Content
Add your own Tailwind classes...
</x-ui.>
Notes
- The component uses Laravel's
Str::markdown()function for parsing - HTML input is stripped for security
- Unsafe links are automatically filtered
- The component uses Tailwind Typography (
prose) classes for styling - Dark mode is automatically supported via
dark:prose-invert