Giter Site home page Giter Site logo

inkdrop-math's Introduction

math

It adds math syntax support to markdown editor and preview. It uses KaTeX to render math typesetting.

Install

ipm install math

Usage

LaTeX syntax

You can write equations in LaTeX syntax like this:

```math
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
```

or

$$
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
$$

It will be rendered as:

block example

Inline example:

Inline math: $\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}$

It will produce:

inline example

Equation numbers

You can use {equation} to have automatic equation numbers. For example:

```math
\begin{equation}
2(x+5)-7 = 3(x-2)
\end{equation}
```

```math
\begin{equation}
2x+10-7 = 3x-6
\end{equation}
```

```math
\begin{equation}
9 = x
\end{equation}
```

It will produce:

equation numbers example

Changelog

  • 1.2.1
    • feat(katex): bump up to 0.13.13
    • fix(style): update CSS to the latest (Thanks Erning)
  • 1.2.0
  • 1.1.2
  • 1.1.1
    • fix(plugin): unload components and mode for math on deactivation
  • 1.1.0
    • feat(katex): update react-katex (Thanks @tonyonodi)
    • fix(fonts): Update font face
  • 1.0.0
    • Support Inkdrop 4.x
  • 0.4.0
    • Bump up katex version
  • 0.3.1
    • Remove unused keymaps and menus
  • 0.3.0
    • Support Inkdrop v3.4.0
  • 0.2.2
    • Support Inkdrop v3.1.1
  • 0.2.1
    • Fix font not loaded
  • 0.2.0
    • Rename package name
    • Change fence char from 67191$ to 67191
  • 0.1.0 - First release

inkdrop-math's People

Contributors

craftzdog avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

inkdrop-math's Issues

Is it possible to force the alignment?

that would be a nice feature.

Normally markdown behaves with "left alignment" but here (except inline) it is forced to use centered

$$
2(x+5)-7 = 3(x-2)
\\
2x+10-7 = 3x-6
\\
9 = x
$$

Fails to render a number of symbols supported by KaTeX

I've noticed that some of the functionality that KaTeX claims to have is missing from this plugin. I've not tested it exhaustively, but \N, \natums, \\, \newline and \R all claim to be supported in the KaTeX documentation, but don't work in the plugin.

I had a look at the package.json of this project and it seems that it has react-katex 2.0.2 as a dependency, which in turn has katex 0.10.0 as a dependency (relevant package.json), while the most recent version of katex is 0.12.0. I don't know if this is the cause of these functions not being supported, but it seems like a good place to start.

The most recent version of react-katex will accept katex >= 0.9.0 as a peer dependency.

I would look into this issue more myself, but I don't have the time to set up a dev environment and understand inkdrop plugins better right now, so for now I'm just filing this issue :)

Bug: Failed to load math package

If I start Inkdrop, I instantly get the error message: "Failed to load the math package. e.memo is not a function". The equations are not rendered correctly.

The currently installed version is v1.2.1.

Using mhchem extension

To write nice chemical equations easily, we can use mhchem extension. Please see the following example.

markup

$\ce{2HCl + Na2CO3 = H2O + CO2 ^ + 2NaCl}$

rendered

According to KaTex's documentation, I just added require('katex/dist/contrib/mhchem.js') to this plugin and it works perfectly. Is it possible to formally add the mhchem support? It might be an option in the plugin settings. What is your opinion?

Using '_' after symbol, end up italic

In math mode, using _after character except for [a-zA-Z0-9], :, ), >, }, and etc., inkdrop editor end up printing subsequent characters in italic.

Inline math not functional

To me the inline math example from readme is not functional in Inkdrop:
Inline math: $\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}$

Incorrect font with v1.2.0

It seems that the plugin is still using the old class names of KaTaX style, resulting in incorrect rendering results.

Here's the screen shot:

The expected results should be

According to the KaTaX's changelog, class name .mathdefault has been changed to .mathnormal.

Currently, I add the following code to styles.less as a workaround

.katex .mathnormal {
  font-family: KaTeX_Math;
  font-style: italic;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.