davidgranstrom / nvim-markdown-preview

Markdown preview for neovim using pandoc and live-server
GNU General Public License v3.0
105 stars 16 forks source link

'Site Can't be Reached' when running :MarkdownPreview #22

Open tardiobscurus opened 2 years ago

tardiobscurus commented 2 years ago

versions:

live-server: @compodoc/live-server 1.2.3
pandoc: 2.9.2.1
node: v18.9.1

PS: I have done :MarkdownPreview github and other default themes; still produce the same problem. I've checked if there is an update on node-js, live-server and pandoc. Seems that node-js had some changes, but is minor line changes so no affect on that.

Whenever I run :MarkdownPreview browser shows a connection error of site not being reached (shown image below): image

It might be from the wrong host using the preview, which is 127.0.0.1 with port 8080. If so, how would I change it in the config file - asking for a friend.

jakesunplugged commented 1 year ago

I get a similar error. After the initial :MarkdownPreview command, the browser loads and shows the preview. Then, after a time, I get an error saying:

Error detected while processing function 6:
line 3: [LiveServer] <--- Last few GCs ---> [13195:0x559b799edfc0] 77584 ms: Mark-Compact 2036.8 (2090.4) -> 2030.0 (2091.6) MB, 1235.00 / 0.00 ms (average mu = 0.103, current mu = 0.010) allocation failure; scavenge might not succeed [13195:0x559b799edfc0] 78819 ms: Mark-Compact 2038.0 (2091.6) -> 2031.1 (2092.9) MB, 1222.54 / 0.00 ms (average mu = 0.059, current mu = 0.010) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

And then the browser gives the error mentioned by OP.

jtpsh commented 1 year ago

I did some investigation here and found live-server starts on the current working directory (where [neo]vim was started). So, if you start [neo]vim in $HOME, live-server will watch every file under it for changes which causes lots of issues and reload non-stop. I have a fix here which restricts the root to temp mount_path: https://github.com/jtpsh/nvim-markdown-preview/commit/e64c258f41fcfdbc3fd11b4dfa13e64f9cdfb085

Not sure if it will cause some issues but it works well for me.