1.1.13 • Published 25 days ago

react-markdown-rtl v1.1.13

Weekly downloads
-
License
ISC
Repository
-
Last release
25 days ago

Markdown Components for React

Supports RTL

Right to Left direction of text

Installation

npm i react-markdown-rtl

Usage

In this example, we use tailwindcss to style the package's components, which come unstylewd and should be styled externally by the user.

import {useState} from 'react'
import {MDEditor, MDRenderer} from "react-markdown-rtl";
import Switch from "./components/ui/Switch";

function App() {
    const [content, setContent] = useState('')
    const [dir, setDir] = useState<'ltr' | 'rtl'>('rtl')
    const onSwitchDir = () => setDir(dir === 'rtl' ? 'ltr' : 'rtl')

  return (
    <>
      <div className={"w-[100vw] flex items-center flex-col gap-4"}>
          <div>
            <span>RTL</span>
            <Switch value={dir ==='rtl'} onChange={onSwitchDir} />
          </div>
          <MDEditor className={"w-[50vw] h-96 outline-none"} isRtl={dir==='rtl'} onChange={(e)=>setContent(e.target.value)} />
          <MDRenderer className={"w-[50vw] border-2 rounded-md border-white p-4 "}  dir={dir} content={content} />
      </div>
    </>
  )
}

export default App

Operators

symbolmeaning
# textxl title
## textl title
### textm title
**text**bold
*text*italic
++text++rtl
--text--ltr
~~text~~strike-through
_text_underline
{RED}text{RED}red color
{BLUE}text{BLUE}blue color
{GREEN}text{GREEN}green color
{YELLOW}text{YELLOW}yellow color
{#somehex}text{#somehex}dynamic hex color
1.1.13

25 days ago

1.1.12

29 days ago

1.1.11

1 month ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago