Giter Club home page Giter Club logo

markdown-it-mathjax's Introduction

Classeur frontend

Build Status NPM version js-standard-style

Frontend application as used in Classeur.

This app was made possible thanks to these great libraries:

The cledit library is also an important part of the project.

Get started

Install

npm install

Start

npm start

Classeur works with a back-end in order to provide connected features such as synchronization, sharing and collaboration. Please refer to the enterprise documentation for a full installation of Classeur.

Contributing

We gladly accept new features if they are useful for others and don't degrade the user experience.

Code format

Code format is checked via the command npm run lint-all ensuring JS, HTML and SCSS files are formatted according to the following rules:

Style Guide

Naming convention

Classeur uses hyphenated BEM as a naming convention for CSS classes.

License

Apache

markdown-it-mathjax's People

Contributors

benweet 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

markdown-it-mathjax's Issues

'\\' seems to have been translated to '\' which makes multi-line formulas broken

On my computer, this input:

## (a) $N$th Partial Sum
We write out the $N$th partial sum of the Fourier series of $f(x)$ and expand its coefficients:
$$ \begin{align}
S_N(x) &= a_0 + \sum_{n=1}^N \left[ a_n \cos \left(\frac{n\pi x}{L}\right) + b_n \sin \left(\frac{n\pi x}{L}\right) \right] \\
&= \frac{1}{2L} \int_{-L}^L f(t) dt \\
&+ \frac{1}{L} \sum_{n=1}^N \left[ \int_{-L}^L f(t) \cos\left( \frac{n\pi t}{L} \right) dt \right] \cos\left( \frac{n\pi x}{L} \right) \\
&+ \frac{1}{L} \sum_{n=1}^N \left[ \int_{-L}^L f(t) \sin\left( \frac{n\pi t}{L} \right) dt \right] \sin\left( \frac{n\pi x}{L} \right) \\
&= \frac{1}{L} \int_{-L}^L f(t) \left\{ \frac{1}{2} + \sum_{n=1}^N  \cos\left[ \frac{n\pi (t-x)}{L} \right] \right\} dt.
\end{align} $$

leads to this result:

<h2>(a) $N$th Partial Sum</h2>
<p>We write out the $N$th partial sum of the Fourier series of $f(x)$ and expand its coefficients:
$$ \begin{align}
S_N(x) &amp;= a_0 + \sum_{n=1}^N \left[ a_n \cos \left(\frac{n\pi x}{L}\right) + b_n \sin \left(\frac{n\pi x}{L}\right) \right] \
&amp;= \frac{1}{2L} \int_{-L}^L f(t) dt \
&amp;+ \frac{1}{L} \sum_{n=1}^N \left[ \int_{-L}^L f(t) \cos\left( \frac{n\pi t}{L} \right) dt \right] \cos\left( \frac{n\pi x}{L} \right) \
&amp;+ \frac{1}{L} \sum_{n=1}^N \left[ \int_{-L}^L f(t) \sin\left( \frac{n\pi t}{L} \right) dt \right] \sin\left( \frac{n\pi x}{L} \right) \
&amp;= \frac{1}{L} \int_{-L}^L f(t) \left{ \frac{1}{2} + \sum_{n=1}^N  \cos\left[ \frac{n\pi (t-x)}{L} \right] \right} dt.
\end{align} $$</p>

Then it don't work.

Is it my wrong usage or the rule should be improved?

Rendering issue when using equal signs on lines

There seems to be a problem when rendering math blocks which contains equal signs (=) on a single line. It seems to interpret this as a heading (this is done by the lheading parse rule in markdown-it), screwing up the entire rendering of the output.

Example input which shows this behavior:

$\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}
\begin{pmatrix}4 & 5\end{pmatrix}
=
\begin{pmatrix}6 & 7\end{pmatrix}$

Disabling the lheading rule in block (md.block.ruler.disable(['lheading'])) fixes the issue, but this breaks al headings of this kind (as expected).

Avoid escaping punctuation

First of all, thanks for this great plugin!

If I'm not mistaken, the plugin runs after escaping punctuation, which breaks valid LaTeX math commands like \,, \;, ...
Would it be possible to run the plugin before the escaping happens, or would this have some unwanted consequences?

How to use it in browser?

Hi, can I just download the markdown-it-mathjax.js file and reference it directly from browser side? Otherwise, could you help to build it and share it in a dist folder like other plugins do? Thanks!

subscript expression doesn't work as expected

I think I've stumbled on a bug where in-text formulas with subscript aren't working as expected. Please let me know what you think.

Expected

$\sum_{\$4}$ => <p>\(sum_{\$4}^2\)</p>

Actual

$\sum_{\$4}$ => <p>$sum_{\(4}^2\)</p>

As you can see it appears to be converting the inner $4 as the beginning of the MathJax expression.

Here's what Pandoc evaluates to:
2020-04-20_13-53

React Hotloading issues.

Working with webpack HMR proxied through browsersync and the following config, I get the right formatting, however as I change the files, I require a full page refresh to get the equations..

import React from 'react';
import {render} from 'react-dom';
import ReactMarkdown from 'react-markdown';
import mdit from 'markdown-it';

const singleton = (creator) => {
  let obj;
  return () => obj || (obj = creator());
};


const md = singleton(() =>
  mdit({html: true, linkify: true})
  .use(require('markdown-it-mathjax')())
);

const input = '# Math Rulez! \n  $$\\sqrt{3x-1}+(1+x)^2 \\frac{23}{3}$$';

var rs = md().render(input);

function createMarkup() {
  return {__html: rs };
}

class App extends React.Component {
  render () {
    return <div dangerouslySetInnerHTML={createMarkup()} />;
  }
}

render(<App/>, document.getElementById('react'));

if (module.hot) {
  module.hot.accept();
}

Is this normal behavior?

Live preview doesn't work well with LaTeX

It seems like when you have the live preview enabled with LaTeX, the font changed for a split second when it updates and then goes back to normal. Is this a known bug?

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.