MacDownApp / macdown

Open source Markdown editor for macOS.
https://macdown.uranusjr.com/
9.46k stars 1.09k forks source link

bug in editor rendering #822

Closed chipbrock closed 7 years ago

chipbrock commented 7 years ago

hi I have found a bug in the rendering of latex in the editor. The following snippet works in the ultimate rendering in html, but fails in the editor and the renderer in macdown in two ways:

## Calculating a Speed

Some traditional jargon and nomenclature. “Change” and “change-of” always means the difference between where you *are* as compared with where you *were*. Suppose I start out with $\$150$ and my wife gives me $\$50$. What's the net *change in* my net worth? We can represent this simple transaction as  

$$\begin{align}
\Delta(\text{my wealth}) &= \text{where I ended up} - \text{where I started} \\
 &= \$150 - \$100=\$50
\end{align}$$

which is the definition of our $\Delta$: always "the end minus the beginning," the final value of some quantity minus the initial value of that quantity.

In MouFresh Air + math is "green" so I'll refer to color:

  1. The equation block in the middle actually treats the first $ in $$\begin as black and the second $ as green and then \end \end{align}$ is black and the last $ is green....and the entire rest of the document is green. In between everything is green except "150" and "50".

  2. the funny business of $ in the paragraph above renders incorrectly in the macdown renderer, but properly in the html file that's produced. I confess that the tossed salad of /'s and $'s was trial and error! Problem 1 is independent of whether the paragraph is present or not.

FranklinYu commented 7 years ago
  1. I have slightly edited the topic. Please verify whether this is what you meant.
  2. The first issue (about syntax highlight, if I understand it correctly) is known in #489 (which is labeled as v0.7 but not actually fixed in v0.7).
  3. I don't quite understand the second issue. Is it about rendering? If you mean “the \\ doesn’t behave correctly”, then yes, this is again a known issue #535. I’m not sure about anything else.
chipbrock commented 7 years ago

28 june:

Untitled 2.key.pdf maybe the attachments didn't stick...

hi I’ll keep thinking about your questions, but I’m not sure I explained myself properly. I’ve attached an image that is a collage of renderings.

  1. What both Macdown and Atom produce is entirely proper in safari after running Jekyll on the output. That’s at the top. Pretty.

  2. In the middle is the “green” Macdown editor and the side-by-side render that Macdown produces. All text for the rest of the file is “green”…except inside mathematics blocks which are now black.

  3. At the bottom is the same thing for Atom, the only other tool that I know of and that works (Lightpaper is terrible).

Does that explain better what I was trying to describe?

thanks

Ray Brock

On Jun 21, 2017, at 8:52 PM, Franklin Yu notifications@github.com<mailto:notifications@github.com> wrote:

  1. I have slightly edited the topic. Please verify whether this is what you meant.
  2. The first issue (about syntax highlight, if I understand it correctly) is known in #489https://github.com/MacDownApp/macdown/issues/489 (which is labeled as v0.7 but not actually fixed in v0.7).
  3. I don't quite understand the second issue. Is it about rendering? If you mean “the \ doesn’t behave correctly”, then yes, this is again a known issue #535https://github.com/MacDownApp/macdown/issues/535. I’m not sure about anything else.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MacDownApp/macdown/issues/822#issuecomment-310245011, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AETlzYoACW191wQYNDaZZSW3JIukKjv7ks5sGbrhgaJpZM4OBgT0.

chipbrock commented 7 years ago

It's happened again...with the align environment. Surely that's the culprit somehow. Below are the offending lines.

The first $ in the $$ before the environment call is black...the second $ is green --- and everything that follows in the whole document is also then green...except for any variable inside of single $ $ brackets. (Remember from the previous post that "green" is the mathematics environment notation inside of Macdown.

Here is the code:

Start writing…filling blanks, making notations, even copying what your eyes see — yes, by all means copy what you are reading! Then when it’s time to stand down and go back to reading, you’ll see this symbol:

Our appetite for algebraic complexity will be very modest. We’ll not encounter formulas that are much more complicated than these:

$$ \begin{align} y &= a\times x = ax \quad \text{ solve for $x$ to get}\quad x=y/a \ y &= x + z \quad \text{ solve for $x$ to get}\quad x=y-z \ y &= a\times x + b = ax + b \quad \text{ solve for $x$ to get}\quad x= \frac{y-b}{a} \ y & = \sqrt{ a+x} \quad \text{ solve for $x$ to get}\quad x = y^2 -a \end{align} $$

You can do this, right? That’s about all that you’ll need to remember of algebra. Just remember the rule. Then...it’s merely a game—a puzzle to solve.

...and so on,

FranklinYu commented 7 years ago

The wording is still kind of convoluted. I assume that you are only talking about the editor panel, also known as “source code panel”, that is, the one on the left. Is that right? You are satisfied about how it previews, right?

chipbrock commented 7 years ago

Sorry for being “convoluted”...

Yes. As you can see from the three screen shots that I prepared for you on June 28th, the issue is in the editor panel, which apparently is really called the “source code panel”. It renders correctly as the screen shots show.

On Jul 2, 2017, at 6:47 PM, Franklin Yu notifications@github.com<mailto:notifications@github.com> wrote:

The wording is still kind of convoluted. I assume that you are only talking about the editor panel, also known as “source code panel”, that is, the one on the left. Is that right? You are satisfied about how it previews, right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MacDownApp/macdown/issues/822#issuecomment-312521739, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AETlzS1vsgCqhbaeab7qAObLQBRQvtauks5sKB4AgaJpZM4OBgT0.


Raymond Brock University Distinguished Professor Department of Physics and Astronomy 3210 BPS Building Michigan State University East Lansing, MI 48824 sent from: raymond.brock@gmail.commailto:raymond.brock@gmail.com brock@pa.msu.edumailto:brock@pa.msu.edu

MSU office: (517)353-1693/884-5579 open fax: (517)355-6661 secure fax: (517)351-0688 Vidyo personal room: http://goo.gl/AgiDJ4 CERN Office: 32 2-B03 * 76-71756

Twitter: @chipbrock Home: http://www.pa.msu.edu/~brock/ ISP220: http://www.pa.msu.edu/courses/ISP220/ ISP213H: http://www.pa.msu.edu/courses/2007spring/ISP213H/ Facebook: http://msu.facebook.com/profile.php?id=2312233

FranklinYu commented 7 years ago

Then I would rather close this issue since it is just a duplicate of #489. You can subscribe to that issue for updates. Sorry about that.

chipbrock commented 7 years ago

Maybe they are the same...

Certainly, as I tried to explain clearly, but obviously failed, escaping an actual monetary $ sign was not working in line. That’s still not working as far as I can tell in Macdown, but works fine in Atom. In Latex, of course you’d write \$ to escape and get just “$” and I think in some mmd environments, \$.

I thought I had a second problem inside of $$\begin{align} environments, but after reading #489 I see that in both of the instances I was trying to put math inside of \text{blah blah $x$ blah blah}... inside of a multiline Latex math environment…which would of course be perfectly fine in Latex (and is fine in Atom).

So in that sense it’s the single $ issue, but slightly different perhaps. Here $ does not work (inside of \text{ } in a Latex environment).

I see from #489 that this has been an issue for more than a year!

Ray

On Jul 2, 2017, at 10:48 PM, Franklin Yu notifications@github.com<mailto:notifications@github.com> wrote:

Then I would rather close this issue since it is just a duplicate of #489https://github.com/MacDownApp/macdown/issues/489. You can subscribe to that issue for updates.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MacDownApp/macdown/issues/822#issuecomment-312537856, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AETlzY9ermfswITbnnvUO7EHRBjCx9Lzks5sKFaEgaJpZM4OBgT0.


Raymond Brock University Distinguished Professor Department of Physics and Astronomy 3210 BPS Building Michigan State University East Lansing, MI 48824 sent from: raymond.brock@gmail.commailto:raymond.brock@gmail.com brock@pa.msu.edumailto:brock@pa.msu.edu

MSU office: (517)353-1693/884-5579 open fax: (517)355-6661 secure fax: (517)351-0688 Vidyo personal room: http://goo.gl/AgiDJ4 CERN Office: 32 2-B03 * 76-71756

Twitter: @chipbrock Home: http://www.pa.msu.edu/~brock/ ISP220: http://www.pa.msu.edu/courses/ISP220/ ISP213H: http://www.pa.msu.edu/courses/2007spring/ISP213H/ Facebook: http://msu.facebook.com/profile.php?id=2312233