@shiyanlou/marked

2.2.22 • Public • Published

marked-ext

安装

$ npm install @shiyanlou/marked --save

使用

<template>
  <div ref="marked" class="markdown-body" v-html="markedStr" />
</template>

<script>
import '@shiyanlou/marked/lib/styles.css'
import marked from '@shiyanlou/marked'

export default {
  data() {
    return {
      str: '## 标题\n',
    }
  },
  computed: {
    markedStr() {
      return marked(this.str)
    },
  },
  mounted() {
    marked.renderExtends(this.$refs.marked)
  },
  updated() {
    marked.renderExtends(this.$refs.marked)
  },
}
</script>

一、插入公式(基于 Katex)

1. 行内公式

在实验楼学习编程非常棒 $ a = 5 $ 可以这样写公式

2. 独立成行的公式

$$ a = 5 $$

二、插入视频(基于 video.js)

视频格式使用 mp4

1. 新写法

```video
http://labfile.oss-cn-hangzhou.aliyuncs.com/shiyanlou_desktop/desktop.flv
```

2. 以前的写法(不推荐)

`@
http://labfile.oss-cn-hangzhou.aliyuncs.com/shiyanlou_desktop/desktop.flv
@`

三、插入 checker

```checker
- name: 检查是否执行过 Python3
  script: |
    #!/bin/bash
    grep python3 /home/shiyanlou/.zsh_history
  error: |
    我们发现您还没有执行过 Python3 解释器
```

Readme

Keywords

none

Package Sidebar

Install

npm i @shiyanlou/marked

Weekly Downloads

0

Version

2.2.22

License

none

Unpacked Size

1.82 MB

Total Files

73

Last publish

Collaborators

  • chenyx007