
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
react-mde-minio-subnet
Advanced tools
A simple yet powerful and extensible React Markdown Editor. React-mde has no 3rd party dependencies.
yarn add @javier.alejandro.castro/react-mde
React-mde is agnostic regarding how to preview Markdown. The examples will use Showdown
yarn add showdown
It is also possible to return a Promise to React Element from generateMarkdownPreview
, which makes
it possible to use ReactMarkdown as a preview.
React-mde is a completely controlled component.
import React, { useState } from 'react';
import { ReactMdeProvider, ReactMdeEditor } from '@javier.alejandro.castro/react-mde';
import * as Showdown from 'showdown';
const converter = new Showdown.Converter({
tables: true,
simplifiedAutoLink: true,
strikethrough: true,
tasklists: true,
});
const App = () => {
const [value, setValue] = useState('**Hello world!!!**');
return (
<div className="container">
<ReactMdeProvider>
<ReactMdeEditor
value={value}
onChange={setValue}
generateMarkdownPreview={(markdown) =>
Promise.resolve(converter.makeHtml(markdown))
}
/>
</ReactMdeProvider>
</div>
);
};
export default App;
React-mde comes with SVG icons extracted from FontAwesome.
You can customize the way icons are resolved by passing your own getIcon
that will return a ReactNode
given a command name.
<ReactMdeProvider
getIcon={(name) => <MyCustomIcon name={name} />}
// ...
>
<ReactMdeEditor {...props} />
</ReactMdeProvider>
The types are described below
write
, preview
,uploadingFile
and pasteDropSelect
.The types are described below
onChange
event.
state changes: allow the component user to customize surrounding CSS for allowing to expand to full screen editing.prop
is falsy, then no preview is going to be generated.text
and triggeredBy
(character that triggered the suggestions). The result should be an array of {preview: React.ReactNode, value: string}
.
The preview
is what is going to be displayed in the suggestions box. The value
is what is going to be inserted in the textarea
on click or enter.loadSuggestions
.textArea
.React-mde does not automatically sanitize the HTML preview. If your using Showdown, this has been taken from their documentation:
Cross-side scripting is a well known technique to gain access to private information of the users of a website. The attacker injects spurious HTML content (a script) on the web page which will read the user’s cookies and do something bad with it (like steal credentials). As a countermeasure, you should filter any suspicious content coming from user input. Showdown doesn’t include an XSS filter, so you must provide your own. But be careful in how you do it…
You might want to take a look at showdown-xss-filter.
It is also possible to return a Promise to a React Element from generateMarkdownPreview
, which makes
it possible to use ReactMarkdown as a preview. ReactMarkdown has built-in XSS protection.
React-mde is MIT licensed.
This started as a fork of https://github.com/andrerpena/react-mde to enable additional features
npm install --legacy-peer-deps
FAQs
React Markdown Editor
The npm package react-mde-minio-subnet receives a total of 5 weekly downloads. As such, react-mde-minio-subnet popularity was classified as not popular.
We found that react-mde-minio-subnet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.