1.0.0 • Published 5 years ago

@mathssyfy/markdown-it-katex v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

@mathssyfy/markdown-it-katex

Plugin markdown-it for katex rendering with ability to add global \newcommand

Installation

yarn add @mathssyfy/markdown-it-katex
# or
npm install @mathssyfy/markdown-it-katex --save

Add CSS:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">

Basic

const md = require('markdown-it')();
const mkn = require('@mathssyfy/markdown-it-katex');
md.use(mkn);

Add newcommands

Example:

const md = require('markdown-it')();
const mynewcommands = '\\displaystyle'
   +'\\newcommand{\\vect}[1]{\\overrightarrow{#1}}'
   +'\\newcommand{\\Oij}{\\left(O;\\vect{i};\\vect{j}\\right)}';
const mkn = require('@mathssyfy/markdown-it-katex');
md.use(mkn, {
     "newcommands": mynewcommands
   });

Katex

Katex supported functions

The native katex syntax also is supported:

const mymacroskatex = {
   "\\f": "f(#1)"
};
const mynewcommands = '\\newcommand{\\g}[1]{g\\left(#1\\right)}';
const mkn = require('@mathssyfy/markdown-it-katex');
md.use(mkn, {
   "macros": mymacroskatex,
   "newcommands": mynewcommands
})
1.0.0

5 years ago

0.1.0

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago