定制 mrshanebarron/markdown 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrshanebarron/markdown

最新稳定版本:v1.0.3

Composer 安装命令:

composer require mrshanebarron/markdown

包简介

Markdown renderer component for Laravel - supports Livewire and Vue

README 文档

README

A markdown renderer component for Laravel applications. Converts markdown text to styled HTML. Works with Livewire and Vue 3.

Installation

composer require mrshanebarron/markdown

Livewire Usage

Basic Usage

<livewire:sb-markdown :content="$markdownContent" />

With Custom Styling

<livewire:sb-markdown
    :content="$article"
    prose-class="prose-lg prose-blue"
/>

Livewire Props

Prop Type Default Description
content string '' Markdown content
prose-class string '' Additional prose classes

Vue 3 Usage

Setup

import { SbMarkdown } from './vendor/sb-markdown';
app.component('SbMarkdown', SbMarkdown);

Basic Usage

<template>
  <SbMarkdown :content="markdown" />
</template>

<script setup>
const markdown = `
# Hello World

This is **bold** and *italic* text.

## Lists

- Item one
- Item two
- Item three

## Code

\`\`\`javascript
const greeting = 'Hello!';
console.log(greeting);
\`\`\`
`;
</script>

Blog Post Example

<template>
  <article class="max-w-3xl mx-auto py-8">
    <h1 class="text-4xl font-bold mb-4">{{ post.title }}</h1>
    <p class="text-gray-500 mb-8">{{ post.date }}</p>

    <SbMarkdown
      :content="post.content"
      prose-class="prose-lg"
    />
  </article>
</template>

Documentation Viewer

<template>
  <div class="flex">
    <nav class="w-64 p-4 border-r">
      <button
        v-for="doc in docs"
        :key="doc.id"
        @click="activeDoc = doc"
        class="block w-full text-left px-3 py-2 rounded hover:bg-gray-100"
      >
        {{ doc.title }}
      </button>
    </nav>

    <main class="flex-1 p-8">
      <SbMarkdown :content="activeDoc.content" />
    </main>
  </div>
</template>

Vue Props

Prop Type Default Description
content String '' Markdown string
proseClass String '' Additional Tailwind prose classes

Supported Syntax

Markdown Output
# Heading <h1>
## Heading <h2>
### Heading <h3>
**bold** <strong>
*italic* <em>
~~strikethrough~~ <del>
`code` <code>
``` <pre><code>
[link](url) <a>
![alt](src) <img>
* item <ul><li>
1. item <ol><li>
> quote <blockquote>
--- <hr>

Features

  • Headers: H1, H2, H3 support
  • Emphasis: Bold, italic, strikethrough
  • Links: External links with noopener
  • Images: Rounded image styling
  • Lists: Ordered and unordered
  • Code: Inline and block code
  • Blockquotes: Quote styling
  • Prose Styling: Tailwind Typography

Styling

Uses Tailwind CSS Typography:

  • Prose base styling
  • Customizable with prose modifiers
  • Automatic paragraph spacing
  • Code block styling
  • Link styling

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Tailwind CSS 3.x
  • @tailwindcss/typography (recommended)

License

MIT License

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-14