feat: markdown render for thread author

This commit is contained in:
Liu Jiangyi
2020-06-22 00:00:48 +08:00
parent 290c9a03c6
commit b8b6dcf68d
4 changed files with 63 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import './Flows.css';
import LazyLoad from './react-lazyload/src';
import {AudioWidget} from './AudioWidget';
import {TokenCtx, ReplyForm} from './UserAction';
import renderMd from './Markdown'
import {API, THUHOLE_API_ROOT} from './flows_api';
@@ -129,7 +130,7 @@ class FlowItem extends PureComponent {
render() {
let props=this.props;
let parts=props.parts||split_text(props.info.text,[
let parts=props.parts||split_text(renderMd(props.info.text),[
['url_pid',URL_PID_RE],
['url',URL_RE],
['pid',PID_RE],

8
src/Markdown.js Normal file
View File

@@ -0,0 +1,8 @@
import MarkdownIt from 'markdown-it'
let md = new MarkdownIt({
html: false,
linkify: false // avoid collision with text_splitter.js
})
export default (text) => md.render(text)