Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-markdown-doc

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-markdown-doc

Markdown Parser for Vue

  • 0.1.12
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

vue-markdown-doc

vue的markdown组件,可渲染markdown文件

安装

NPM

$ npm install --save vue-markdown-doc

Yarn

$ yarn add vue-markdown-doc

示例代码

<template>
  <div id="app">
      <MarkdownDoc
              :images="images"
              :mdRaw="mdRaw"
              :prevPage="{
                  title: 'SmartLinkTree 树',
                  url: '/docs/components/smart-link-tree'
              }"
              :nextPage="{
                  title: 'smartLinkInput 输入框',
                  url: '/docs/components/smart-link-input'
              }"
      />
  </div>
</template>

<script>
import "vue-markdown-doc/lib/index.css";
import MarkdownDoc from "vue-markdown-doc";

export default {
  name: 'FormDoc',
  components: {
      MarkdownDoc
  },
  data() {
    return {
      mdRaw: require('./component.md').default,
      images: {
          'todo-ui-form.png': require('./images/todo-ui-form.png')
      }
    }
  }
}
</script>

raw-loader

获取.md文件流需要使用raw-loader,配置参考官方文档

使用vue-cli的raw-loader配置

配置vue.config.js

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    ...,
    chainWebpack: config => {
        config.module
            .rule('raw-loader')
            .test(/\.md$/)
            .use('raw-loader')
            .loader('raw-loader')
            .end()
    }
}

VueMarkdownDoc props

参数类型说明默认值
mdRawStringmarkdown字符串-
imagesObject配置markdown中使用的图片,对于上例,在markdown中使用图片的格式为:{{"image": "todo-ui-form.png","width":1000,"height":530}}-
prevPageObject格式:{title: String, url: String},配置上一个模块的跳转-
nextPageObject格式:{title: String, url: String},配置下一个模块的跳转-
navFixBoolean目录栏固定在顶端true
scrollElementParentObject页面滚动事件挂载的dom元素window

FAQs

Package last updated on 24 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc