SpaceVim / SpaceVim

A modular Vim/Neovim configuration
https://spacevim.org/
GNU General Public License v3.0
20.23k stars 1.41k forks source link

Markdown Preview do not work #3925

Closed adelin-b closed 3 years ago

adelin-b commented 3 years ago

Expected behavior, english is required

MarkdownPreview to function

The reproduce ways from Vim starting (Required!)

1 - simple config file

# init.toml
[[layers]]
name = "lang#markdown"

2 - Open a markdown file

3 - SPC l p nothing happend, no error msg nothing, same if calling :MarkdownPreview

Debug info

Please press SPC h I, debug info will be put into clipboard, then paste all content below.

SpaceVim layers:

- VersionControl:       not loaded          https://spacevim.org/layers/VersionControl/
+ autocomplete:             loaded          https://spacevim.org/layers/autocomplete/
- chat:                 not loaded          https://spacevim.org/layers/chat/
+ checkers:                 loaded          https://spacevim.org/layers/checkers/
- chinese:              not loaded          https://spacevim.org/layers/chinese/
- colorscheme:          not loaded          https://spacevim.org/layers/colorscheme/
+ core#banner:              loaded          https://spacevim.org/layers/core/banner/
+ core#statusline:          loaded          https://spacevim.org/layers/core/statusline/
+ core#tabline:             loaded          https://spacevim.org/layers/core/tabline/
+ core:                     loaded          https://spacevim.org/layers/core/
- cscope:               not loaded          https://spacevim.org/layers/cscope/
- ctrlp:                not loaded          https://spacevim.org/layers/ctrlp/
- ctrlspace:            not loaded          https://spacevim.org/layers/ctrlspace/
- debug:                not loaded          https://spacevim.org/layers/debug/
- denite:               not loaded          https://spacevim.org/layers/denite/
+ edit:                     loaded          https://spacevim.org/layers/edit/
- exprfold:             not loaded          no exists
- floobits:             not loaded          https://spacevim.org/layers/floobits/
- foldsearch:           not loaded          https://spacevim.org/layers/foldsearch/
+ format:                   loaded          https://spacevim.org/layers/format/
- fuzzy:                not loaded          no exists
- fzf:                  not loaded          https://spacevim.org/layers/fzf/
- games:                not loaded          no exists
- git:                  not loaded          https://spacevim.org/layers/git/
- github:               not loaded          https://spacevim.org/layers/github/
- gtags:                not loaded          https://spacevim.org/layers/gtags/
- incsearch:            not loaded          no exists
- indentmove:           not loaded          no exists
- japanese:             not loaded          https://spacevim.org/layers/japanese/
- lang#WebAssembly:     not loaded          https://spacevim.org/layers/lang/WebAssembly/
- lang#actionscript:    not loaded          https://spacevim.org/layers/lang/actionscript/
- lang#agda:            not loaded          https://spacevim.org/layers/lang/agda/
- lang#asciidoc:        not loaded          https://spacevim.org/layers/lang/asciidoc/
- lang#aspectj:         not loaded          https://spacevim.org/layers/lang/aspectj/
- lang#assembly:        not loaded          https://spacevim.org/layers/lang/assembly/
- lang#autohotkey:      not loaded          https://spacevim.org/layers/lang/autohotkey/
- lang#batch:           not loaded          https://spacevim.org/layers/lang/batch/
- lang#c:               not loaded          https://spacevim.org/layers/lang/c/
- lang#chapel:          not loaded          https://spacevim.org/layers/lang/chapel/
- lang#clojure:         not loaded          https://spacevim.org/layers/lang/clojure/
- lang#coffeescript:    not loaded          https://spacevim.org/layers/lang/coffeescript/
- lang#crystal:         not loaded          https://spacevim.org/layers/lang/crystal/
- lang#csharp:          not loaded          https://spacevim.org/layers/lang/csharp/
- lang#d:               not loaded          https://spacevim.org/layers/lang/d/
- lang#dart:            not loaded          https://spacevim.org/layers/lang/dart/
- lang#dockerfile:      not loaded          https://spacevim.org/layers/lang/dockerfile/
- lang#eiffel:          not loaded          https://spacevim.org/layers/lang/eiffel/
- lang#elixir:          not loaded          https://spacevim.org/layers/lang/elixir/
- lang#elm:             not loaded          https://spacevim.org/layers/lang/elm/
- lang#erlang:          not loaded          https://spacevim.org/layers/lang/erlang/
- lang#extra:           not loaded          https://spacevim.org/layers/lang/extra/
- lang#factor:          not loaded          no exists
- lang#forth:           not loaded          no exists
- lang#fortran:         not loaded          https://spacevim.org/layers/lang/fortran/
- lang#foxpro:          not loaded          https://spacevim.org/layers/lang/foxpro/
- lang#fsharp:          not loaded          https://spacevim.org/layers/lang/fsharp/
- lang#go:              not loaded          https://spacevim.org/layers/lang/go/
- lang#goby:            not loaded          https://spacevim.org/layers/lang/goby/
- lang#gosu:            not loaded          https://spacevim.org/layers/lang/gosu/
- lang#graphql:         not loaded          https://spacevim.org/layers/lang/graphql/
- lang#groovy:          not loaded          https://spacevim.org/layers/lang/groovy/
- lang#hack:            not loaded          https://spacevim.org/layers/lang/hack/
- lang#haskell:         not loaded          https://spacevim.org/layers/lang/haskell/
- lang#html:            not loaded          https://spacevim.org/layers/lang/html/
- lang#hy:              not loaded          https://spacevim.org/layers/lang/hy/
- lang#idris:           not loaded          https://spacevim.org/layers/lang/idris/
- lang#io:              not loaded          https://spacevim.org/layers/lang/io/
- lang#ipynb:           not loaded          https://spacevim.org/layers/lang/ipynb/
- lang#j:               not loaded          https://spacevim.org/layers/lang/j/
- lang#janet:           not loaded          https://spacevim.org/layers/lang/janet/
- lang#java:            not loaded          https://spacevim.org/layers/lang/java/
- lang#javascript:      not loaded          https://spacevim.org/layers/lang/javascript/
- lang#json:            not loaded          no exists
- lang#julia:           not loaded          https://spacevim.org/layers/lang/julia/
- lang#kotlin:          not loaded          https://spacevim.org/layers/lang/kotlin/
- lang#lasso:           not loaded          https://spacevim.org/layers/lang/lasso/
- lang#latex:           not loaded          https://spacevim.org/layers/lang/latex/
- lang#lisp:            not loaded          https://spacevim.org/layers/lang/lisp/
- lang#livescript:      not loaded          https://spacevim.org/layers/lang/livescript/
- lang#lua:             not loaded          https://spacevim.org/layers/lang/lua/
+ lang#markdown:            loaded          https://spacevim.org/layers/lang/markdown/
- lang#matlab:          not loaded          https://spacevim.org/layers/lang/matlab/
- lang#moonscript:      not loaded          https://spacevim.org/layers/lang/moonscript/
- lang#nim:             not loaded          https://spacevim.org/layers/lang/nim/
- lang#nix:             not loaded          https://spacevim.org/layers/lang/nix/
- lang#ocaml:           not loaded          https://spacevim.org/layers/lang/ocaml/
- lang#pact:            not loaded          https://spacevim.org/layers/lang/pact/
- lang#pascal:          not loaded          https://spacevim.org/layers/lang/pascal/
- lang#perl:            not loaded          https://spacevim.org/layers/lang/perl/
- lang#php:             not loaded          https://spacevim.org/layers/lang/php/
- lang#plantuml:        not loaded          https://spacevim.org/layers/lang/plantuml/
- lang#pony:            not loaded          https://spacevim.org/layers/lang/pony/
- lang#powershell:      not loaded          https://spacevim.org/layers/lang/powershell/
- lang#processing:      not loaded          https://spacevim.org/layers/lang/processing/
- lang#prolog:          not loaded          https://spacevim.org/layers/lang/prolog/
- lang#puppet:          not loaded          https://spacevim.org/layers/lang/puppet/
- lang#purescript:      not loaded          https://spacevim.org/layers/lang/purescript/
- lang#python:          not loaded          https://spacevim.org/layers/lang/python/
- lang#r:               not loaded          https://spacevim.org/layers/lang/r/
- lang#racket:          not loaded          https://spacevim.org/layers/lang/racket/
- lang#red:             not loaded          https://spacevim.org/layers/lang/red/
- lang#ring:            not loaded          https://spacevim.org/layers/lang/ring/
- lang#ruby:            not loaded          https://spacevim.org/layers/lang/ruby/
- lang#rust:            not loaded          https://spacevim.org/layers/lang/rust/
- lang#scala:           not loaded          https://spacevim.org/layers/lang/scala/
- lang#scheme:          not loaded          https://spacevim.org/layers/lang/scheme/
- lang#sh:              not loaded          https://spacevim.org/layers/lang/sh/
- lang#slim:            not loaded          https://spacevim.org/layers/lang/slim/
- lang#solidity:        not loaded          no exists
- lang#sql:             not loaded          no exists
- lang#supercollider:   not loaded          no exists
- lang#swift:           not loaded          https://spacevim.org/layers/lang/swift/
- lang#swig:            not loaded          no exists
- lang#tcl:             not loaded          https://spacevim.org/layers/lang/tcl/
- lang#toml:            not loaded          https://spacevim.org/layers/lang/toml/
- lang#typescript:      not loaded          https://spacevim.org/layers/lang/typescript/
- lang#v:               not loaded          https://spacevim.org/layers/lang/v/
- lang#vbnet:           not loaded          https://spacevim.org/layers/lang/vbnet/
- lang#vim:             not loaded          https://spacevim.org/layers/lang/vim/
- lang#vue:             not loaded          https://spacevim.org/layers/lang/vue/
- lang#wdl:             not loaded          no exists
- lang#wolfram:         not loaded          https://spacevim.org/layers/lang/wolfram/
- lang#xml:             not loaded          https://spacevim.org/layers/lang/xml/
- lang#xquery:          not loaded          no exists
- lang#zig:             not loaded          https://spacevim.org/layers/lang/zig/
- leaderf:              not loaded          https://spacevim.org/layers/leaderf/
- lsp:                  not loaded          https://spacevim.org/layers/language-server-protocol/
- mail:                 not loaded          no exists
- operator:             not loaded          no exists
- org:                  not loaded          no exists
- shell:                not loaded          https://spacevim.org/layers/shell/
- sudo:                 not loaded          https://spacevim.org/layers/sudo/
- test:                 not loaded          https://spacevim.org/layers/test/
- tmux:                 not loaded          https://spacevim.org/layers/tmux/
- tools#dash:           not loaded          https://spacevim.org/layers/tools/dash/
- tools#mpv:            not loaded          https://spacevim.org/layers/tools/mpv/
- tools#screensaver:    not loaded          no exists
- tools#zeal:           not loaded          https://spacevim.org/layers/tools/zeal/
- tools:                not loaded          https://spacevim.org/layers/tools/
+ ui:                       loaded          https://spacevim.org/layers/ui/
- unite:                not loaded          https://spacevim.org/layers/unite/
- vim:                  not loaded          no exists

Screenshots

wsdjeg commented 3 years ago

In lang#markdown layer, the preview plugin is markdown-preview.nvim, there should be a way to debug this plugin.

wsdjeg commented 3 years ago

https://github.com/iamcco/markdown-preview.nvim/blob/0aaaf6474ca455fb4a78cb776a591a73edc74629/test/init.vim

I just found this file, maybe you can use bootstrap function and set these env, then debug this plugin.

TheWall89 commented 3 years ago

@adelin-b : the Markdown preview works just fine on my SpaceVim. When I press SPC l p or I run :MarkdownPreview, the plugin opens a new tab in my browser (Firefox) showing the preview of the markdown file. It also updates itself in real-time (before I save the file!). Have you checked your browser after running that command?

adelin-b commented 3 years ago

I have markdown preview on my personal vim config and it is working fine, I will investigate next time I try spacevim then if it works for others.

strazto commented 3 years ago

Hi - I can offer a fix for this.

Assuming you've followed the workaround to install MarkdownPreview from https://github.com/SpaceVim/SpaceVim/issues/4234#issuecomment-835836563

Using the config given in the iamcco/markdown-preview.nvim readme, we can see that it serves the page on localhost, on some port, and tries to open the link in our browser.

For me, the problem wasn't that the webserver wasn't running, it was that my browser wasn't automatically opening the link when MarkdownPreview was run.

I set the following:

:let g:mkdp_echo_preview_url = 1

And clicked/copied the link from the echo'd output

tan-wei commented 2 years ago

Hi - I can offer a fix for this.

Assuming you've followed the workaround to install MarkdownPreview from #4234 (comment)

Using the config given in the iamcco/markdown-preview.nvim readme, we can see that it serves the page on localhost, on some port, and tries to open the link in our browser.

For me, the problem wasn't that the webserver wasn't running, it was that my browser wasn't automatically opening the link when MarkdownPreview was run.

I set the following:

:let g:mkdp_echo_preview_url = 1

And clicked/copied the link from the echo'd output

It works. But how can we open the browser automatically? BTW, on Windows, it works well. on my MacOS, it seems that iTerm2 does not open the browser.

tan-wei commented 2 years ago

We can see code here: https://github.com/SpaceVim/SpaceVim/blob/26baf7c2e4ef09a282ea688c7e802c2a1bc37ce1/autoload/SpaceVim/layers/lang/markdown.vim#L126

It uses open-browser to open browser. I can confirm that the server is launched and I can type the address manually in browser, it works correctly. But SpaceVim can not open browser automatically when I call MarkdownPreview. And I can use :OpenBrowser xxx to open browser.

tan-wei commented 2 years ago

Hmm. My neovim without SpaceVim works well...