draftjs-to-latex
Convert Draftjs content to LaTeX source code.
Features
Block Type | Supported | Block Enum | Notes |
---|---|---|---|
Bold |
|
BOLD |
|
Italic |
|
ITALIC |
|
Underline |
|
UNDERLINE |
|
Inline Code |
|
CODE |
|
H1 |
|
header-one |
|
H2 |
|
header-two |
|
H3 |
|
header-three |
|
UL |
|
unordered-list-item |
only support for continuous list |
OL |
|
ordered-list-item |
only support for continuous list |
Equation |
|
MATH |
using katex for rendering |
Image |
|
||
Table |
|
||
Code Snippet |
|
Limitations
Not support overlapping styles.
Usage
npm i @zhyd1997/draftjs-to-latex
# yarn
yarn add @zhyd1997/draftjs-to-latex
Only support ES6:
import { scan } from "@zhyd1997/draftjs-to-latex";
const generatedTex = scan(contentState);
// console.log(generatedTex);
Development
npm install
npm test