feat:markdown 渲染支持嵌入视频 (#2565)

This commit is contained in:
吴多益 2021-09-15 23:22:57 +08:00 committed by GitHub
parent f537adcc55
commit d9dd2227a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,10 @@ order: 58
}
```
## 视频
可以使用 `![text](video.mp4)` 语法来嵌入视频。
## 属性表
| 属性名 | 类型 | 默认值 | 说明 |

View File

@ -518,6 +518,7 @@ if (fis.project.currentMedia() === 'publish') {
'!mdurl/**',
'!uc.micro/**',
'!markdown-it/**',
'!markdown-it-html5-media/**',
'!punycode/**'
],
@ -542,6 +543,7 @@ if (fis.project.currentMedia() === 'publish') {
'mdurl/**',
'uc.micro/**',
'markdown-it/**',
'markdown-it-html5-media/**',
'punycode/**'
],
@ -576,7 +578,8 @@ if (fis.project.currentMedia() === 'publish') {
'!linkify-it/**',
'!mdurl/**',
'!uc.micro/**',
'!markdown-it/**'
'!markdown-it/**',
'!markdown-it-html5-media/**'
]
}),
postpackager: [

View File

@ -56,6 +56,7 @@
"keycode": "^2.1.9",
"lodash": "^4.17.15",
"markdown-it": "^12.0.6",
"markdown-it-html5-media": "^0.6.0",
"match-sorter": "^6.3.0",
"mobx": "^4.5.0",
"mobx-react": "^6.1.4",

View File

@ -3,11 +3,15 @@
*/
import markdownIt from 'markdown-it';
// @ts-ignore
import {html5Media} from 'markdown-it-html5-media';
const markdown = markdownIt({
linkify: true
});
markdown.use(html5Media);
export default function (content: string) {
return markdown.render(content);
}