vincentcn / markdown-scroll-sync

Auto-scroll markdown-preview tab to match markdown source
MIT License
95 stars 26 forks source link

Make it work with markdown-preview-plus #4

Open szhorvat opened 9 years ago

szhorvat commented 9 years ago

Can it be made to work with markdown-preview-plus? That package adds useful LaTeX support to markdown previews.

mark-hahn commented 9 years ago

Holy cow. The contributors are a who's who of the Atom team. Why is there so much interest in LaTeX?

I took a quick look and MPP looks like a lot more work to sync than MP required. In MP I just took the markdown up to the top line of the screen and rendered it to html using the sameroaster module that MP used. Then I looked though the preview DOM to find the element matching the end of my html. MPP looks like it uses a lot more logic than just roaster. I could be wrong.

I'll look at it again tomorrow when I'm fresh but it looks hard.

On Tue, Mar 10, 2015 at 6:33 PM, Szabolcs Horvát notifications@github.com wrote:

Can it be made to work with markdown-preview-plus https://atom.io/packages/markdown-preview-plus? That package adds useful LaTeX support to markdown previews.

— Reply to this email directly or view it on GitHub https://github.com/mark-hahn/markdown-scroll-sync/issues/4.

mark-hahn commented 9 years ago

Can you please send me a sample file containing LaTeX? It needs to be long enough to test scrolling.

janneck commented 9 years ago

If it is difficult with markdown-preview-plus, how about markdown-preview-katex? It works equally well.

Enclosed a sample file with lots of LaTeX (text from Wikipedia, math from Mathjax docs):

--- 8< ---

# Math Examples

## The Lorenz Equations

The Lorenz system is a system of ordinary differential equations (the Lorenz equations) first studied by Edward Lorenz. It is notable for having chaotic solutions for certain parameter values and initial conditions. In particular, the Lorenz attractor is a set of chaotic solutions of the Lorenz system which, when plotted, resemble a butterfly or figure eight.

$$\begin{align}
\dot{x} & = \sigma(y-x) \\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}$$

## The Cauchy-Schwarz Inequality

In mathematics, the Cauchy–Schwarz inequality is a useful inequality encountered in many different settings, such as linear algebra, analysis, probability theory, and other areas. It is considered to be one of the most important inequalities in all of mathematics. It has a number of generalizations, among them Hölder's inequality.

The inequality for sums was published by Augustin-Louis Cauchy (1821), while the corresponding inequality for integrals was first proved by Viktor Bunyakovsky (1859). The modern proof of the integral inequality was given by Hermann Amandus Schwarz (1888).

$$\begin{equation*}
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
\end{equation*}$$

## A Cross Product Formula

In mathematics, the cross product or vector product is a binary operation on two vectors in three-dimensional space and is denoted by the symbol ×. The cross product a × b of two linearly independent vectors a and b is a vector that is perpendicular to both and therefore normal to the plane containing them. It has many applications in mathematics, physics, engineering, and computer programming.

$$\begin{equation*}
\mathbf{V}_1 \times \mathbf{V}_2 =  \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} &  \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} &  \frac{\partial Y}{\partial v} & 0
\end{vmatrix}
\end{equation*}$$

## The probability of getting \(k\) heads when flipping \(n\) coins is

Probability is the measure of the likeliness that an event will occur. Probability is quantified as a number between 0 and 1 (where 0 indicates impossibility and 1 indicates certainty). The higher the probability of an event, the more certain we are that the event will occur. A simple example is the toss of a fair coin. Since the two outcomes are equally probable, the probability of "heads" equals the probability of "tails", so the probability is 1/2 (or 50%) chance of either "heads" or "tails".

$$\begin{equation*}
P(E)   = {n \choose k} p^k (1-p)^{ n-k}
\end{equation*}$$

## A Rogers-Ramanujan Identity

In mathematics, the Rogers–Ramanujan identities are two identities related to basic hypergeometric series, first discovered and proved by Leonard James Rogers (1894). They were subsequently rediscovered (without a proof) by Srinivasa Ramanujan some time before 1913. Ramanujan had no proof, but rediscovered Rogers's paper in 1917, and they then published a joint new proof (Rogers & Ramanujan 1919). Issai Schur (1917) independently rediscovered and proved the identities.

$$\begin{equation*}
1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},
\quad\quad \text{for $|q|<1$}.
\end{equation*}$$

## Maxwell's Equations

Maxwell's equations are a set of partial differential equations that, together with the Lorentz force law, form the foundation of classical electrodynamics, classical optics, and electric circuits. These fields in turn underlie modern electrical and communications technologies. Maxwell's equations describe how electric and magnetic fields are generated and altered by each other and by charges and currents. They are named after the Scottish physicist and mathematician James Clerk Maxwell, who published an early form of those equations between 1861 and 1862.

$$\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\   \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}$$

## Inline Typesetting (Mixing Markdown and TeX)

While display equations look good for a page of samples, the ability to mix math and *formatted* **text** in a paragraph is also important.

This expression $\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a **[Markdown-formatted](http://daringfireball.net/projects/markdown/)** sentence.  
szhorvat commented 9 years ago

Thank you @janneck for sending this and sorry @mark-hahn mark about forgetting to do this myself ...

mark-hahn commented 9 years ago

I'm having trouble with the markdown-preview-plus dependencies, runas and oniguruma. Node-gyp is failing. I'll try some more but I may have to file in issue.

On Mon, Apr 13, 2015 at 2:34 PM, Szabolcs Horvát notifications@github.com wrote:

Thank you @janneck https://github.com/janneck for sending this and sorry @mark-hahn https://github.com/mark-hahn mark about forgetting to do this myself ...

— Reply to this email directly or view it on GitHub https://github.com/mark-hahn/markdown-scroll-sync/issues/4#issuecomment-92507830 .

szhorvat commented 9 years ago

I should link to this feature request for markdown-preview-plus:

https://github.com/Galadirith/markdown-preview-plus/issues/9

mark-hahn commented 9 years ago

I went to atom/node-runas to post my problem and found this: https://github.com/atom/node-runas/issues/11 This bug goes all the way back to september! This affects a lot of packages but there must not be many people with the problem or they would have fixed it long ago.

Sorry. I'll pay attention to this but until I can install the plus package my hands are tied.

lanceplaine commented 9 years ago

:+1:

laughedelic commented 9 years ago

+1 would be very nice to have it working with markdown-preview-plus

leipert commented 8 years ago

@chaserhkj It seems with markdown-preview-plus 2.0.0, we broke #28. At least, it is not working for me. @mark-hahn We added instructions for windows to mpp https://github.com/Galadirith/markdown-preview-plus/blob/master/docs/win-install.md

chaserhkj commented 8 years ago

@leipert It seems that it works as well as it did before with all my documents, though there're still a few syncing problems which has already emerged before 2.0.0. I am planning to investigate these later, but the overall state is working here for me. Could you get me an example failing document, if any?

mark-hahn commented 8 years ago

I've just released a new version 2.0.1 that is a total rewrite. Can someone please check to see how the new release affects this issue?

robxu9 commented 8 years ago

Can't get it to work with markdown-preview-plus 2.2.2 and markdown-scroll-sync 2.0.3...

danielbayley commented 8 years ago

Same; markdown-scroll-sync 2.1.1 currently doesn't work with markdown-preview-plus 2.2.2.

pkjkrai66 commented 8 years ago

Update: markdown-scroll-sync 2.1.2 currently doesn't work with markdown-preview-plus 2.4.0 It would really be nice to have it working for MPP

AStupidBear commented 7 years ago

+1. Same problem.