qdm12 / stackedit-docker

StackEdit 5.14.5 Server in a light Docker container
https://hub.docker.com/r/qmcgaw/stackedit
MIT License
42 stars 16 forks source link

Code block highlight didn't work #11

Closed TyrantLucifer closed 3 years ago

TyrantLucifer commented 3 years ago

Hi @qdm12, thanks for your work! I'm using almost daily stackedit with your docker image. But I found a problem about the highlight of code block. It seems that do not work. I try to build stackedit by myself, but appear the same problem. Could you help me to solve it?😋 image

qdm12 commented 3 years ago

Hello! I'll update the stackedit version over the weekend, maybe that will help. I'll ping you here once it's done.

TyrantLucifer commented 3 years ago

Thank you for your reply. I am waiting for you good message!

qdm12 commented 3 years ago

Just had a quick look and it's actually still updated with Stackedit 5.14.5 which is their latest release. I'll try your example more in the coming week. Maybe that's an issue with the actual stackedit program: https://github.com/benweet/stackedit 🤔

TyrantLucifer commented 3 years ago

In stackedit.io, the problem is not appear, what a strange problem it is.😂 The version build by ourselves doesn't work normally. What do you think we raise an issue for actual stackedit?

lorenx commented 3 years ago

Hello. I'm not actually using this project, I built my own Dockerfile (I cloned StackEdit v5.14.10 tag), but I run into the same issue.

It seems related to Prismjs and you can also trigger it by going to Menu / Settings, since it'll try to highlight YAML code there:

Menu / Settings

There's one weird thing I noticed though... If I build StackEdit without using Docker, Prismjs highlights things without any issue... but inside Docker the error occurs (and since it happens inside your container as well, it's an interesting coincidence).

I'll keep on debugging things here, let me know if you find any solution. Thank you.

qdm12 commented 3 years ago

Thanks @lorenx for your help. Well I spent an hour trying to build my own image without success, since stackedit is a dependency nightmare... I will eventually get to this, but ughh I am feeling like archiving this repository right now!

lorenx commented 3 years ago

Ok, I found it! It's because docker runs with root privileges and npm complains about it.

Outside Docker, at some point during npm install, it says:

> stackedit@5.14.10 postinstall /srv/stackedit-fork
> gulp build-prism

[22:47:55] Using gulpfile /srv/stackedit-fork/gulpfile.js
[22:47:55] Starting 'build-prism'...
[22:47:56] Finished 'build-prism' after 118 ms

But when running inside Docker I suddenly noticed this:

npm WARN lifecycle stackedit@5.14.10~postinstall: cannot run in wd stackedit@5.14.10 gulp build-prism (wd=/srv/stackedit-fork)

And this breaks PrismJS somehow.

To fix it, I did npm install --unsafe-perm, as they say here.


About the dependencies, there are many that can be upgraded but yeah, it's a nightmare. I kept everything as it is in v5.14.10, I only upgraded katex: ^0.13.18 and it runs nicely.

Let me know if it works for you as well.

qdm12 commented 3 years ago

It's because docker runs with root privileges and npm complains about it.

@lorenx Do you mean at build time or runtime?

@TyrantLucifer 1c88c9cfb57ea69c2f6c57071c37c1ed57d1e71c should had fixed it, you can try pulling the latest image; for me syntax highlighting (tried Java) works. Let me know if I misunderstood the problem.

TyrantLucifer commented 3 years ago

It works. Thank you for your good job.

lorenx commented 3 years ago

Do you mean at build time or runtime?

@qdm12 Well, it depends when you run npm install (I don't use Go). I'm doing it at build time to have my application fully versioned and ready to use.

Anyway, I'm not sure it changed that much from v5.14.5 to v5.14.10, but it's good it's working now.