Closed xdewx closed 3 years ago
By "live preview" do you mean while
Have you tried to preview the test file?
I mean it works out of expectation when editing the markdown file.
The result of testing is :
user@15:51:00>instant-markdown-d$ sudo cat tests/test_math.md | instant-markdown-d --mathjax --debug
instant-mardown-d version: v0.2.0-rc.1
nodejs version: v8.10.0
Run the following to manually open browser:
xdg-open http://localhost:8090/
Rendered html saved as debug.html
Error: Uncaught [Error: EACCES: permission denied, open 'debug.html']
.......
.......
at Function.WAITEXECUTE (file:///usr/local/lib/node_modules/instant-markdown-d/node_modules/mathjax/unpacked/MathJax.js:348:50)
errno: -13,
code: 'EACCES',
syscall: 'open',
path: 'debug.html' }
Don't use sudo to run the test. Also, copy the test file and run it in your home directory, so you have permissions. Then attach the debug.html that you get.
{ Error: EACCES: permission denied, open 'debug.html'}
This problem is solved by run sudo chmod 777 -R ./*
Then,I rerun sudo cat tests/test_math.md | instant-markdown-d --mathjax --debug
,debug.html
is generated normally.However,it seems normal.
The debug.html
is not supported file type ,so,I rename it to debug.txt
.
And,I attached a .png
file which is grasp from Firefox.
debug.txt
So it works. The message "Live preview is unavailable" will happen when the instant-markdown-d
server is stopped.
So did who stop the instant-markdown-d
server?
I always edit a .md
file with vim xx.md
,then firefox is opened . If I keep editing the file ,the new content will not appear .This step can't be shown by running cat xx.md | instant-markdown-d --debug
.
The formulas are always rendered correctly .
Then it is an issue with how instant-markdown-d is started by Vim. We need a way to debug this in Vim... I will see if it is possible. Thanks for the issue report!
Ok, thank u!
And add some problems:
vim
,the page in firefox won't close automatically and If I continue to close firefox,the node process still exists which I have to kill -9
All of this problems happen in version 0.2.0-rc.1
,if I use version 0.1
everything is fine.
Okay that is weird. I thought the node server died while open vim. But now you say it still persists...
Anyways it is a beta release. So keep using the stable one for now. :)
With suan/vim-instant-markdown#161 you should be able to debug this from vim. Do try it.
Could you tell me how to do it ?
Do you mean :
vim-instant-markdown
from master into .vim/bundle/
vim xx.md
Just now, it seems that I found something helpful.
In my .vimrc
, there was let g:instant_markdown_port = 10001
.
I commented it just now, then I vim xx.md
, it is pleasant that the page in browser is changing with my editing.
So, I guess if I use custom server port ,the Live preview
module still sends content to the default port not the new. Maybe that is just where the problem is.
However ,the node process still persists after I exits vim no matter what port I use.
It is mentioned in the readme
If you do not use a plugin manager, copy the after/ftplugin/markdown/instant-markdown.vim file into ~/.vim/after/ftplugin/markdown/ (creating directories as necessary),
And then
For troubleshooting, server startup and curl communication from Vim to the server can be logged into a file.
let g:instant_markdown_logfile = '/tmp/instant_markdown.log'
Then do steps 2 and 3
It seems that I am right.
If I remove let g:instant_markdown_port = 10001
The
Live preview
is available. The logfile has nothing wrong!
If I add let g:instant_markdown_port = 10001
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 8090: refuse connection connection established! % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 8090: refuse connection
However ,the node process still persists after I exits vim no matter what port I use.
Thanks for that. I will fix the port option right away.
Nice, port option has been fixed .
The node process still can't exit automatically after I exit vim
and close browser .This can cause that browser can't be started automatically if I vim xx.md
after my exiting and closing .
A lot has changed now and a new version is out, so I hope this is no longer an issue. I would close this issue now.
Problem summary
Expected
Live preview is not available with instant-markdown-d@0.2.0.rc1 . If I rollback to lower version ,it works very well except that no mathjax support.
Environment Information
Provide the output of test command (required)
Run
npm test&; sleep 5; npm stop
or at least equivalent ofcd tests; cat test_math.md | instant-markdown-d --mathjax --debug
and paste the console output here:Generate logfiles if appropriate
~/.vimrc
or~/.config/nvim/init.vim
where variables forvim-instant-markdown
defineddebug.html
Steps to reproduce the issue (required)
Start with command you used to install
instant-markdown-d
1.sudo npm install -g instant-markdown-d@0.2.0.rc1 2. 3.
Screen shot (if possible)