Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const rules = this._postProcessRules(
_.merge(
{},
SimpleMarkdown.defaultRules,
initialRules(mergedStyles),
this.props.rules
)
)
const child = Array.isArray(this.props.children)
? this.props.children.join('')
: this.props.children
const blockSource = child + '\n\n'
const tree = SimpleMarkdown.parserFor(rules)(blockSource, {
inline: false
})
return SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules, 'react'))(
tree
)
} catch (errors) {
this.props.errorHandler
? this.props.errorHandler(errors, children)
: console.error(errors)
}
}
constructor(props) {
super(props);
const rules = SimpleMarkdown.defaultRules;
this.parser = SimpleMarkdown.parserFor(rules);
this.reactOutput = SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules, 'react'));
const blockSource = this.props.children + '\n\n';
const parseTree = this.parser(blockSource, { inline: this.props.parseInline });
const outputResult = this.reactOutput(parseTree);
const defaultStyles = this.props.useDefaultStyles && styles ? styles : {};
const _styles = StyleSheet.create(Object.assign(defaultStyles, this.props.markdownStyles));
this.state = {
syntaxTree: outputResult,
styles: _styles
};
}
componentWillMount: function() {
var mergedStyles = _.merge({}, styles, this.props.style);
var rules = require('./rules')(mergedStyles);
rules = _.merge({}, SimpleMarkdown.defaultRules, rules);
var parser = SimpleMarkdown.parserFor(rules);
this.parse = function(source) {
var blockSource = source + '\n\n';
return parser(blockSource, {inline: false});
};
this.renderer = SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules, 'react'));
},
*/
var characterCount = (source) => {
var ast = parse(source);
var content = getContent(ast).join('');
return content.length;
};
module.exports = {
characterCount: characterCount,
traverseContent: traverseContent,
parse: parse,
parseInline: inlineParser,
reactFor: SimpleMarkdown.reactFor,
ruleOutput: SimpleMarkdown.ruleOutput(rules, "react"),
basicOutput: SimpleMarkdown.reactFor(
SimpleMarkdown.ruleOutput(rules, "react")
),
sanitizeUrl: SimpleMarkdown.sanitizeUrl,
};
componentWillMount: function() {
var mergedStyles = _.merge({}, styles, this.props.style);
var rules = require('./rules')(mergedStyles);
rules = _.merge({}, SimpleMarkdown.defaultRules, rules);
var parser = SimpleMarkdown.parserFor(rules);
this.parse = function(source) {
var blockSource = source + '\n\n';
return parser(blockSource, {inline: false});
};
this.renderer = SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules, 'react'));
},