Skip to content

zhyd1997/draftjs-to-latex

Repository files navigation

draftjs-to-latex

codecov

NPM npm (scoped)

npm npm npm

Convert Draftjs content to LaTeX source code.

Features

Block Type Supported Block Enum Notes
Bold ✅ Yes BOLD
Italic ✅ Yes ITALIC
Underline ✅ Yes UNDERLINE
Inline Code ✅ Yes CODE
H1 ✅ Yes header-one
H2 ✅ Yes header-two
H3 ✅ Yes header-three
UL ✅ Yes unordered-list-item only support for continuous list
OL ✅ Yes ordered-list-item only support for continuous list
Equation ✅ Yes MATH using katex for rendering
Image ❌ Missing
Table ❌ Missing
Code Snippet ❌ Missing

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