Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
axe-markdown-loader
Advanced tools
allows you to import md files as React components and easy creation of documentation
Developer-friendly way to automate React component documentation (including automation of props tables & examples).
import SomeMarkdownFile from "./SomeMarkdownFile.md";
<SomeMarkdownFile
exampleProp="hello"
anotherProps={() => {
console.log('world')}
}
/>
Requirements:
- Webpack
- React 16.2.0 or greater
The below demo video will demonstrate how to document any component; in the below example I used ReactTable by react-tools
"App.js" :
import SomeMarkdownFile from "./SomeMarkdownFile.md";
const YourReactComponent = () => (
<div>
<SomeMarkdownFile
propVar={3344}
propString="Ipsum lorem ;)"
propFunc={() => {
console.log('hello')}
}
/>
</div>
);
export default YourReactComponent;
npm install axe-markdown-loader --save-dev
or if you use yarn:
yarn add axe-markdown-loader --dev
Add to your webpack module/rules configuration:
{
test: /\.md/ ,
loader: ['babel-loader', 'axe-markdown-loader'] ,
exclude: /node_modules/
}
module.exports = {
entry:'./src/entry',
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].js'
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.md/, exclude: /node_modules/, loader: ['babel-loader', 'axe-markdown-loader'] },
]
}
};
@import "~axe-markdown-loader/src/themes/dark.theme";
or use light theme:
@import "~axe-markdown-loader/src/themes/light.theme";
# A title
```jsx
<div className="the-best-class-ever">
Hello
</div>
``` .
Add "show-source" next to fence block language name:
# A title
```jsx show-source
<div>Hello</div>
``` .
Use #{....} template blocks to inject variables
```jsx show-source
<div>#{ 500 * 500 }</div>
<div className="#{props.someClassName}">hello</div>
#{true ? `<div className="visible">hello #{5 * 5}</div>` : ""}
``` .
---
imports:
'reduce': 'reduce-object'
'TestComponent': './TestComponent'
---
```jsx show-source
<TestComponent
someProp="lorem ipsum"
/>
``` .
Add "no-render" next to fence block:
---
imports:
'reduce': 'reduce-object'
'TestComponent': './TestComponent'
---
```jsx show-source no-render
<TestComponent
someProp="lorem ipsum"
/>
``` .
The following will turn the page's background red:
# Paint it red!
```scss show-source
body {
background: red;
}
``` .
Add "no-render" if you don't want to apply your scss styles:
```scss show-source no-render
body {
background: red;
}
``` .
When writing markdown examples, use ~~~ to open/close your fence blocks:
# Writing markdown fence blocks
```md show-source
# Title
## The subtitle
~~~css
body {
background:red;
}
~~~
``` .
Add "no-line-numbers" if you don't want display the line numbers in the source code:
# A title
```jsx show-source no-line-numbers
<div className="the-best-class-ever">
Hello
</div>
``` .
Automatically generate PropsTable by using axe-prop-types.
This requires installing axe-prop-types & configuring webpack by following instructions here: axe-prop-types
--- .
imports:
'ReactLoginPanel': 'react-login-panel'
--- .
## PropTypes
[PROPS_TABLE(ReactLoginPanel)]
MIT
FAQs
allows you to import md files as React components and easy creation of documentation
The npm package axe-markdown-loader receives a total of 5 weekly downloads. As such, axe-markdown-loader popularity was classified as not popular.
We found that axe-markdown-loader demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.