Skip to content

Commit 36974d5

Browse files
committed
v1.0.0 - first commit
0 parents  commit 36974d5

File tree

12 files changed

+5789
-0
lines changed

12 files changed

+5789
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Markdown Components for React
2+
3+
4+
#### Supports RTL
5+
6+
_Right to Left direction of text_
7+
8+
## Installation
9+
10+
`npm i react-markdown-rtl`
11+
12+
## Usage
13+
14+
_In this example, we use tailwindcss to style the package's components, which come unstylewd and should be styled externally by the user._
15+
16+
```
17+
import {useState} from 'react'
18+
import {MDEditor, MDRenderer} from "react-markdown-rtl";
19+
20+
function App() {
21+
const [content, setContent] = useState('')
22+
const [dir, setDir] = useState<'ltr' | 'rtl'>('rtl')
23+
const onSwitchDir = () => setDir(dir === 'rtl' ? 'ltr' : 'rtl')
24+
25+
return (
26+
<>
27+
<div>
28+
<MDEditor className={"w-[50vw] h-96 outline-none"} onSwitchDir={onSwitchDir} isRtl={dir==='rtl'} onChange={(e)=>setContent(e.target.value)} />
29+
<MDRenderer className={"w-[50vw]"} dir={dir} content={content} />
30+
</div>
31+
</>
32+
)
33+
}
34+
35+
export default App;
36+
```
37+
38+
## Operators
39+
40+
symbol | meaning
41+
-- | --
42+
# text| xl title
43+
## text| l title
44+
### text| m title
45+
**text** | bold
46+
*text* | italic
47+
++text++ | rtl
48+
--text-- | ltr
49+
~~text~~ | strike-through
50+
_text_ | underline
51+

0 commit comments

Comments
 (0)