Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {connect} from 'react-redux';
import {Row, Col,Input} from 'antd';
import marked from 'marked'
import hljs from 'highlight.js';
import {getHtml, OldTime} from '../../until';
import {markdownConfig} from "../../config/markdown";
// import './index.less';
const { TextArea } = Input;
const {options,config} = markdownConfig
hljs.configure(config)
marked.setOptions({
highlight: (code) => hljs.highlightAuto(code).value,
...options
});
class Edit extends Component {
constructor(props) {
super(props)
this.state = {
previewContent: '',
aceBoxH: null,
originContent: '',
inputValue:'',
}
this.cacheValue()
this.containerScroll = this.containerScroll.bind(this)
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import marked from 'marked';
const renderer = new marked.Renderer();
// Set link target to `_parent` to work properly in an embed.
renderer.link = (href, title, text) =>
`<a title="" href="${href}">${text}</a>`;
marked.setOptions({ renderer });
export default class Markdown extends PureComponent {
render() {
const { content, ...rest } = this.props;
const __html = marked(content);
return <div>;
}
}
Markdown.propTypes = {
content: PropTypes.string,
};
</div>
import React,{Component} from 'react';
import {Tick,JSONModel,OBJModel,MTLModel,GLTFModel,DAEModel,AmbientLight,DirectionLight} from '../../dist/scripts/react-3d-viewer.js'
import marked from 'marked'
import './show_model.less'
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false
});
// GLTFModel;
// AmbientLight,DirectionLight
// debugger
export class JSON_ extends Component{
constructor(props){
const rendererDefault = new marked.Renderer()
rendererAnchor.heading = (text, level) => {
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-')
return (
`
<a id="${escapedText}" class="anchor-link"></a>${text}` +
`<a href="#${escapedText}" class="anchor-link-style">${'#'}</a>
`
)
}
marked.setOptions({
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight(code) {
return prism.highlight(code, prism.languages.jsx)
},
})
const anchorLinkStyle = theme => ({
'& .anchor-link-style': {
display: 'none',
},
render() {
marked.setOptions({
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight(code, lang) {
if (lang === 'jsx') {
return Prism.highlight(code, Prism.languages.jsx);
} else {
return require('highlight.js').highlight(lang || 'js', code).value;
}
}
});
return (
function setupDefaults () {
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function (code, lang, callback) {
require('pygmentize-bundled')({
lang: lang,
format: 'html'
}, code, function (err, result) {
callback(err, result.toString());
});
},
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false
line = tokens[idx].lines[0]
return '<p data-line="' + line + '" class="line">'
}
return '</p><p>'
}
md.renderer.rules.heading_open = (tokens, idx) => {
let line
if (tokens[idx].lines && tokens[idx].level === 0) {
line = tokens[idx].lines[0]
return ''
}
return ''
}
marked.setOptions({
highlight: (code) => {
require('highlight.js/styles/github-gist.css')
return require('highlight.js').highlightAuto(code).value
},
})
@observer
class PreviewEditor extends Component {
constructor (props) {
super(props)
}
makeHTMLComponent (html) {
return React.DOM.div({ dangerouslySetInnerHTML: { __html: html } })
}
</p>
mounted: function(){
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function (code) {
return highlight.highlightAuto(code).value;
}
});
},
methods: {
import Promise from 'bluebird'
import logger from 'logger'
import marked from 'marked'
import hljs from 'highlight.js'
const LABEL = 'processMarkdown.js'
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: true,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false
})
var sequentialId = 0
var renderer = new marked.Renderer()
renderer.heading = function (text, level) {
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-')
return '
if( !description && !examples ) {
return "";
}
if ( description ) {
text = description
}
if ( examples && examples.length > 0 ) {
examples = [ " Examples: \n" ].concat(examples).join("\n\t");
text = text + examples;
}
if(marked) {
marked.setOptions({gfm: true, breaks: true})
return new Handlebars.SafeString(marked(text));
} else {
return text;
}
});