All Projects → obedm503 → showdown-katex

obedm503 / showdown-katex

Licence: MIT license
Math typesetting for showdown

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to showdown-katex

Mdmath
LaTeX Math for Markdown inside of Visual Studio Code.
Stars: ✭ 675 (+2009.38%)
Mutual labels:  math, katex
augmath
Interactive Computer Algebra System. Augmenting how we *do* mathematics using computers
Stars: ✭ 41 (+28.13%)
Mutual labels:  math, katex
vue-showdowns-editor
A markdown editor using codemirror and previewer using @jhuix/showdowns for Vue.js.
Stars: ✭ 27 (-15.62%)
Mutual labels:  katex, showdown
Katex
Fast math typesetting for the web.
Stars: ✭ 14,623 (+45596.88%)
Mutual labels:  math, katex
Remark Math
remark and rehype plugins to support math
Stars: ✭ 129 (+303.13%)
Mutual labels:  math, katex
Dominhhai.github.io
My Blog
Stars: ✭ 8 (-75%)
Mutual labels:  math, katex
React Katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 345 (+978.13%)
Mutual labels:  math, katex
Prosemirror Math
Schema and plugins for "first-class" math support in ProseMirror!
Stars: ✭ 43 (+34.38%)
Mutual labels:  math, katex
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+512.5%)
Mutual labels:  math, katex
react-katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 135 (+321.88%)
Mutual labels:  math, katex
ngx-showdown
Angular (>=2) integration for Showdown
Stars: ✭ 16 (-50%)
Mutual labels:  showdown
codex
A repository of mathematical knowledge written in the MathLingua language.
Stars: ✭ 17 (-46.87%)
Mutual labels:  math
Atosym
algebraic expressions parsing and evaluation through a property system based algorithm
Stars: ✭ 15 (-53.12%)
Mutual labels:  math
Cuba.jl
Library for multidimensional numerical integration with four independent algorithms: Vegas, Suave, Divonne, and Cuhre.
Stars: ✭ 65 (+103.13%)
Mutual labels:  math
Tau.jl
A Julia module providing the definition of the circle constant Tau (2π)
Stars: ✭ 33 (+3.13%)
Mutual labels:  math
vscode-markdown-editor
A vscode extension to make your vscode become a full-featured WYSIWYG markdown editor
Stars: ✭ 249 (+678.13%)
Mutual labels:  katex
c math viewer
Parses, and hovers math formula of c mathematical library functions
Stars: ✭ 36 (+12.5%)
Mutual labels:  math
Draft
▪️Online markdown editor
Stars: ✭ 29 (-9.37%)
Mutual labels:  katex
xits
XITS - OpenType implementation of STIX fonts with math support
Stars: ✭ 299 (+834.38%)
Mutual labels:  math
Oscar.jl
A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
Stars: ✭ 182 (+468.75%)
Mutual labels:  math

showdown-katex

npm install showdown-katex

Showdown extension to render LaTeX math and AsciiMath using KaTeX;

Special characters do not need escaping

Works well alongside bootmark

Config

You can customize what gets passed to the katex renderer by passing a config object.

These are the defaults:

{
  displayMode: true,
  throwOnError: false, // allows katex to fail silently
  errorColor: '#ff0000',
  delimiters: [
    { left: "$$", right: "$$", display: false },
    { left: '~', right: '~', display: false, asciimath: true },
  ],
}

Examples:

<script>
  const converter = new showdown.Converter({
    extensions: [
      showdownKatex({
        // maybe you want katex to throwOnError
        throwOnError: true,
        // disable displayMode
        displayMode: false,
        // change errorColor to blue
        errorColor: '#1500ff',
      }),
    ],
  });
  converter.makeHtml('~x=2~');
</script>

Check katex for more details.

Default Delimiters

Format Left Right Display mode
Latex $$ $$ false
Asciimath ~ ~ false

To define custom delimiters simply define a delimiters property in the config as an array of objects. Each object MUST have a left (string) property with the left delimiter, and a right (string) property with the right delimiter. The oject may also have a display (boolean) property if the delimiter should use display mode instead of inline mode, and an asciimath (boolean) id the delimiter is Asciimath instead of Latex.

Custom delimiters won't disable the defaults, so you can use both custom and default delimiters.

const converter = new showdown.Converter({
  extensions: [
    showdownKatex({
      delimiters: [{ left: '( ͡° ͜ʖ ͡°)', right: '( ͡° ͜ʖ ͡°)', asciimath: true }],
    }),
  ],
});
converter.makeHtml(
  'some text here, ( ͡° ͜ʖ ͡°) E=mc^2 ( ͡° ͜ʖ ͡°), you can still use ~ E=Mc^2 ~',
);

FOUC

If your page suffers from a "Flash Of Unstyled Content," add this to your <body> tag:

<body style="display:none;" onload="document.body.style.display='block'">

This hides the body and shows it only when the JavaScript has loaded.

Math Example

```asciimath
x = (-b +- sqrt(b^2-4ac)) / (2a)
```
x = (-b +- sqrt(b^2-4ac)) / (2a)
```latex
x=\frac{ -b\pm\sqrt{ b^2-4ac } } {2a}
```
x=\frac{ -b\pm\sqrt{ b^2-4ac } } {2a}

They will both render the exact same thing. If the examples don't render correctly click here.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].