
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
remark-react
Advanced tools
remark-react compiles markdown to React. Built on remark, an extensively tested and pluggable parser.
Why? Using innerHTML and dangerouslySetInnerHTML in
React.js is a common cause of XSS
attacks: user input can include script tags and other kinds of active
content that reaches across domains and harms security. remark-react
builds a DOM in React, using React.createElement:
this means that you can display parsed & formatted Markdown content
in an application without using dangerouslySetInnerHTML
.
npm:
npm install remark-react
Parameters
react
— This plugin;options
(Object?
) — See below.Let’s say example.js
looks as follows:
var React = require('react'),
remark = require('remark'),
reactRenderer = require('remark-react');
var App = React.createClass({
getInitialState() {
return { text: '# hello world' };
},
onChange(e) {
this.setState({ text: e.target.value });
},
render() {
return (<div>
<textarea
value={this.state.text}
onChange={this.onChange} />
<div id='preview'>
{remark().use(reactRenderer).processSync(this.state.text).contents}
</div>
</div>);
}
});
React.render(<App />, document.getElementById('app'));
All options, including the options
object itself, are optional:
sanitize
(object
or boolean
, default: undefined
)
— Sanitation schema to use. Passed to
hast-util-sanitize.
The default schema, if none or true
is passed, adheres to GitHub’s
sanitation rules.
This means that non-standard HAST nodes and many
HTML elements are by default santized out. If you want to be more
permissive, you should provide a value for sanitize
.
If false
is passed, it does not sanitize input.
prefix
(string
, default: h-
)
— React key.
createElement
(Function
, default: require('react').createElement
)
— Function to use to create elements.
remarkReactComponents
(object
, default: undefined
)
— Provides a way to override default elements (<a>
, <p>
, etc)
by defining an object comprised of element: Component
key-value
pairs. For example, to output <MyLink>
components instead of
<a>
, and <MyParagraph>
instead of <p>
:
remarkReactComponents: {
a: MyLink,
p: MyParagraph
}
toHast
(object
, default: {}
)
— Provides options for transforming MDAST document to HAST.
See mdast-util-to-hast
for settings.
These can passed to remark.use()
as a second argument.
remark-react works great with:
remark-toc, which generates tables of contents;
remark-github, which generates references to GitHub issues, PRs, users, and more;
...and more.
All remark nodes
can be compiled to HTML. In addition, remark-react looks for an
attributes
object on each node it compiles and adds the found properties
as HTML attributes on the compiled tag.
Additionally, syntax highlighting can be included (completely virtual) with
remark-react-lowlight
.
MIT © Titus Wormer, modified by Tom MacWright and Mapbox
FAQs
Deprecated: this package is no longer maintained. Please use `remark-rehype` to move from remark (markdown) to rehype (HTML) and then replace `remark-react` with [`rehype-react`][rehype-react].
The npm package remark-react receives a total of 9,349 weekly downloads. As such, remark-react popularity was classified as popular.
We found that remark-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.