Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
mui-markdown
Advanced tools
mui-markdown uses markdown-to-jsx and MUI(formerly material-ui) to help you render MD/MDX files with MUI components.
# with npm
npm i mui-markdown
# with yarn
yarn add mui-markdown
The example below will render the h1
tag using MUI Typography
component.
import React from 'react';
import MuiMarkdown from 'mui-markdown';
const App = () => {
return <MuiMarkdown>{`# Hello markdown`}</MuiMarkdown>;
};
export default App;
Props available for MuiMarkdown
component:
Name | Type | Description |
---|---|---|
key | React.key | optional, use it to pass a key |
overrides | MarkdownToJSX.Overrides | optional, check overrides section below |
options | MarkdownToJSX.Options | optional, check options section below |
You can optionally override a tag to use your component.
example of override with a regular HTML tag:
JS and JSX:
import React from 'react';
import MuiMarkdown from 'mui-markdown';
const App = () => {
return (
<MuiMarkdown
overrides={{
h1: {
component: 'p',
props: {
style: { color: 'red' },
},
},
}}
>
{`# Hello markdown`}
</MuiMarkdown>
);
};
export default App;
TS and TSX:
import React from 'react';
import MuiMarkdown from 'mui-markdown';
const App = () => {
return (
<MuiMarkdown
overrides={{
h1: {
component: 'p',
props: {
style: { color: 'red' },
} as React.HTMLProps<HTMLParagraphElement>,
},
}}
>
{`# Hello markdown`}
</MuiMarkdown>
);
};
export default App;
example of override with your component:
JS and JSX:
import React from 'react';
import MuiMarkdown from 'mui-markdown';
import CustomTypography from './components/CustomTypography';
const App = () => {
return (
<MuiMarkdown
overrides={{
h1: {
component: CustomTypography,
props: {
// custom props
},
},
}}
>
{`# Hello markdown`}
</MuiMarkdown>
);
};
export default App;
TS and TSX:
import React from 'react';
import MuiMarkdown from 'mui-markdown';
import CustomTypography, {
CustomTypographyProps,
} from './components/CustomTypography';
const App = () => {
return (
<MuiMarkdown
overrides={{
h1: {
component: CustomTypography,
props: {
// custom props
} as CustomTypographyProps,
},
}}
>
{`# Hello markdown`}
</MuiMarkdown>
);
};
export default App;
You can read about options in the markdown-to-jsx docs.
Note: If you want to override something and also need to set some options, add the overrides
property in the options
. Don't use overrides and options property together on the MuiMarkdown
component.
FAQs
mui-markdown uses markdown-to-jsx and MUI(formerly material-ui) to help you render MD/MDX files with MUI components.
The npm package mui-markdown receives a total of 10,961 weekly downloads. As such, mui-markdown popularity was classified as popular.
We found that mui-markdown demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.