Closed chaserhkj closed 8 years ago
@chaserhkj Thanks for the post :D
On the first issue I can't see any errors that would relate to MPP. Does this problem only happen after syncing? and in which direction? Does ex-mode
/vim-mode
work as expected when you don't sync source/preview? I grab ex-mode and test it out myself. I should not that Atom v1.0.10
was released right around the same time as MPP v2.0.0
so it might be an Atom issue, but I havn't seen any issues on ex-mode
or vim-mode
pop up related to this so I would not conclude that until we're certain it's not MPP :D
On the second issue, the reason why sync is failing is actually not a bug but because with 2.0.0
we've migrated to markdown-it
and to handle equations we are using markdown-it-math
which uses a strickter syntax, so you need to place the $$
on separate lines. So this:
$$\begin{align}
\dot{x} & = \sigma(y-x) \\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}$$
will no longer work, you should use this:
$$
\begin{align}
\dot{x} & = \sigma(y-x) \\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
I hope that's not a deal breaker. It is very possible in an upcoming release we'll add support back in for the original style, but we don't have any date for that yet. But if that's some thing that is important to you then please let me know :D
I'll update you when I've look more in to the ex-mode
issue :D
@chaserhkj @Galadirith
Regarding the math mode, I wrote several issues in markdown-it-math:
@chaserhkj Thanks so much for your patience :D I'm still investigating the ex-mode
/vim-mode
issue which I can repeat locally. Can I ask if you previously had MPP 1.7.0
installed and did it cause you an issue then?
Ok so for reference I have isolated the problem to a particular commit. Everything is working fine at https://github.com/Galadirith/markdown-preview-plus/commit/fa1015b9355d7db388dad13aef4756c176c06508 but not at https://github.com/Galadirith/markdown-preview-plus/commit/7697921502586256ef4c4f0ea210a08a7c6f17f6 after #70 was merged. Going back through the commits of #70 it turns out the issue was introduced by https://github.com/Galadirith/markdown-preview-plus/compare/fb4d3faf4a7c0461dc7758980139ad84cc7142b2...c0583b3b14adb74ab51503211e609687a2d52510.
So to summarise that, it appears that the problem was introduced when markdown-it
was initially integrated. Its really peculiar as as far as I can tell right now ex-mode
really shouldn't be worrying about this. But we've narrowed it down which is great :D
So far I am not able to reproduce any problems with vim-mode
commands such as dd
. For now I will just focus on investigating ex-mode
but if @chaserhkj you do experience those problems what would be incredibly helpful is a minimal set of steps to reproduce the problem. Thanks @chaserhkj :D
Ok wow so this is going down a rather interesting path :D So I have now isolated the exact line that is causing a problem in ex-mode
, lib/ex.coffee#L153
. So it appears that the method Promise.defer()
exists before opening a preview but doesn't after!? :D
Now it seems that ex-mode
is using a depreciated style of Promise
as described over at MDN. My best guess right now is that some module within markdown-it
and its dependencies is overwriting the global Promise
object. Very interesting :D
So still more work to do but we're getting ever closer still :D
WAITWAITWAIT.
Maybe it is the polyfills in https://github.com/runarberg/markdown-it-math ?
Nvm it maybe somewhere else :+1:
@leipert I think you were really close. I don't think its the polyfill used by markdown-it-math
directly, but one of its dependencies ascii2mathml
loads babel/polyfill
which looks to be the culprit:
This will emulate a full ES6 environment
If I simply set var ascii2mathmml = null
in markdown-it-math/index.js#L5
then that appears to cure the problem.
Ok great found the source :D lets think about how to resolve this.
I will write to the ascii2mathml maintainer.
Thanks @leipert :D
As a suggestion, it looks like @runarberg maintains both markdown-it-math
and ascii2mathml
. Maybe they'd be open to simply lazy loading ascii2mathml
in markdown-it-math
but maybe there is a better solution in the core of ascii2mathml
.
@Galadirith I just opened a lazyload PR and wrote an issue in ascii2mathml.
If you have anything to add to those, go a head (your english is faster than mine ;) )
Thanks @leipert they look good to me so I would have nothing to add :D
(The disadvantage of [maybe] writing faster is that you end up writing crazy long comments like this, you are effortlessly succinct. The poor souls who have to read my comments :D)
Oh my goodness, @runarberg has already merged, wow, and checked locally ex-mode
is working just fine :D So we'll need to make sure to bump the version of markdown-it-math
to a 3.x.x
compatible version. That was fun :D
@chaserhkj this fix will roll out on Sunday, thanks for your patience :D
@Galadirith #95 is on the way
@leipert awesome :D
@Galadirith actually you need "markdown-it-math": "^3.0.1"
because the .1
patch has the lazy loading.
Thanks, @runarberg. We did that here: https://github.com/Galadirith/markdown-preview-plus/commit/3d07a2a8d3f74bc9aa5626f60cead20864d6fa3c
On atom 1.0.11
with MPP 2.0.1
, confirming this is fixed.
Sorry for late reply and feedback, for I am not close enough to network yesterday, but thank all of you for the quick and fine work you've done! ^_^
Testing with sync preview feature, I encountered some wierd issues.
:w
command, it failed with the following errorsNot only did ex-mode go wrong, vim-mode is not acting well after this, either. Things like
dd
ing a line would leave a d in the place of the deleted line and other wierd things would happen.I am not sure about where this issue belong, but since it's triggered by this new feature in MPP, I'm submitting it here.
In the example above, I couldn't get anything beyond the first displayed math block synced through this feature. ( Only the 1st 2 headings and the 1st paragraph could be synced )