@filmy/vue-markdown (0.0.1)

Published 2024-09-21 20:20:55 +08:00 by filmy

Installation

@filmy:registry=
npm install @filmy/vue-markdown@0.0.1
"@filmy/vue-markdown": "0.0.1"

About this package

vue-markdown

Vue3 Markdown 组件,使用 jsxtypescript 开发

️ 功能亮点

  • 默认防止 XSS 攻击
  • 支持传递组件渲染指定标签
  • 支持插件
  • 符合 CommonMarkGFM (插件)

📦 安装

pnpm add @filmy/vue-markdown --registry=https://git.mlooc.cn/api/packages/filmy/npm/

💡 用法

<script lang="ts" setup>
  import {ref} from "vue"
  import VueMarkdown from "@filmy/vue-markdown"

  const content = ref("# Hello Markdown")
</script>

<template>
  <VueMarkdown :content="content"/>
</template>

🎁 API

🔖 VueMarkdown Props

属性 类型 默认值 说明
content string - Markdown 内容
components Components - 标签渲染组件列表
rehypePlugins Array - rehype 插件列表
remarkPlugins Array - remark 插件列表
remarkRehypeOptions RemarkRehypeOptions - remark-rehype 配置项
skipHtml boolean false 跳过 html 解析
allowedElements ReadonlyArray 所有标签 允许的标签列表 不能与disallowedElements同时使用
allowElement (element: Readonly, index: number, parent: Readonly | undefined) => boolean | null | undefined - 过滤标签 首选allowedElements/disallowedElements
disallowedElements ReadonlyArray [] 禁止的标签列表 不能与allowedElements同时使用
unwrapDisallowed boolean false 提取禁止标签的内容
urlTransform (url: string, key: string, element: Readonly) => string | null | undefined defaultUrlTransform url 转换

Dependencies

Dependencies

ID Version
@vue/runtime-dom ^3.5.7
comma-separated-tokens ^2.0.3
devlop ^1.1.0
estree-util-is-identifier-name ^3.0.0
hast-util-whitespace ^3.0.0
html-url-attributes ^3.0.0
mdast-util-mdx-expression ^2.0.1
mdast-util-mdx-jsx ^3.1.3
mdast-util-mdxjs-esm ^2.0.1
property-information ^6.5.0
remark-parse ^11.0.0
remark-rehype ^11.1.1
space-separated-tokens ^2.0.2
style-to-object ^1.0.8
unified ^11.0.5
unist-util-position ^5.0.0
unist-util-visit ^5.0.0
vfile ^6.0.3
vfile-message ^4.0.2

Development Dependencies

ID Version
@types/estree ^1.0.6
@types/hast ^3.0.4
@types/unist ^3.0.3
@vitejs/plugin-vue ^5.1.4
@vitejs/plugin-vue-jsx ^4.0.1
typescript ^5.6.2
unplugin-vue-define-options ^1.5.1
vite ^5.2.10
vite-plugin-dts ^4.2.1

Peer Dependencies

ID Version
vue ^3.5.6

Keywords

ast markdown vue
Details
npm
2024-09-21 20:20:55 +08:00
10
filmy
85 KiB
Assets (1)
Versions (2) View all
0.0.2 2024-09-22
0.0.1 2024-09-21