patrickdavey / vimwiki_markdown

A gem to use for converting vimwiki markdown files to html.
MIT License
144 stars 16 forks source link

Does not work with neovim ? #9

Closed copyme closed 7 years ago

copyme commented 7 years ago

So I think I put everything all together:

init.vim

let g:vimwiki_list = [{
  \ 'path': '$HOME/Documents/PersonalWiki',
  \ 'syntax': 'markdown', 'ext': '.md',
  \ 'custom_wiki2html': 'vimwiki_markdown',
  \ 'template_path': '$HOME/Documents/PersonalWiki/templates',
  \ 'template_default': 'default',
  \ 'template_ext': '.tpl'}]

default.tpl

<!DOCTYPE html>
<html>
<head>
<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
 %pygments%
</head>
<body>
<script type="text/javascript" src="../PersonalWiki/templates/MathJax-2.7.0/MathJax.js?config=TeX
AMS-MML_HTMLorMML"></script>
%content%
</body>
</html>

The gem is installed without problems but yet I have an error which says that a conversion from markdown to HTML is not supported.

patrickdavey commented 7 years ago

Hmmmm, honestly, I have no idea. I don't use neovim (yet, though it does sound promising)

Is your vimwiki up to date? As it does require this commit to be part of your vimwiki plugin.

If you work out the issue (and it is neovim specific) please do submit a PR :)

has2k1 commented 7 years ago

I use vimwiki with neovim without any issues .

patrickdavey commented 7 years ago

Well, I'm going to close this issue seeing as @has2k1 has it working with Neovim. I'd double check the commit I referenced above, just to make sure your version of vimwiki can use binaries.

This gem itself, in a way, has nothing to do with vimwiki.. it's just a script that can be called passing in a few arguments (where files are, templates etc.) and then parses them. It's not really anything to do with vimwiki (unless vimwiki changed the arguments it was sending through).

copyme commented 7 years ago

In fact, I found the source of the problem. In the binary file created by gem install is named vimwiki_markdown.ruby2.1 and not vimwiki_markdown.

patrickdavey commented 7 years ago

That's bizarre! If you look in the bin folder -> https://github.com/patrickdavey/vimwiki_markdown/tree/master/bin you'll see the binary is called vimwiki_markdown That is something I've not seen before! What operating system are you using @copyme ? Are you using rvm or anything else to manage your ruby version(s) and gems?

copyme commented 7 years ago

@patrickdavey I use openSUSE Leap 42.3 and I mostly use ruby related packages provided by the operating system repositories, with some exceptions. For the exceptions I just use the gem command. Sorry I am not very familiar with the ruby ecosystem, etc.

NikosAlexandris commented 5 years ago

The settings in vimwiki.rc sourced within from vimrc:

set nocompatible
filetype plugin on
syntax on
set foldmethod=syntax

set runtimepath+=~/archive/notes/vimwiki
let g:vimwiki_root = $HOME . '/archive/notes/vimwiki'
let g:vimwiki_list = [{
            \ 'path': $HOME . '/archive/notes/vimwiki',
            \ 'path_html': $HOME . '/archive/notes/vimwiki/html',
            \ 'syntax': 'markdown',
            \ 'ext': '.md',
            \ 'template_path': '/archive/notes/vimwiki/templates/',
            \ 'template_default': 'default',
            \ 'template_ext': '.tpl',
            \ 'custom_wiki2html': 'vimwiki_markdown',
            \ 'html_filename_parameterization': 1}]
let g:vimwiki_global_ext = 0

and the default.tpl:

<!DOCTYPE html>
<html lang="en">
  <head>
  <title>%title%</title>
  %date%

  %pygments%
</head>
<body id="%title%">
  <h2 id="title">%title%</h2>
  %content%
</body>
</html>

I run on vimwiki version 2.4 (2019-03-24) and I just installed vimwiki_markdown today. Any attempt to :Vimwiki2HTML fails with:

Vimwiki Error: Conversion to HTML is not supported for this syntax

How can I "debug" this problem?

patrickdavey commented 5 years ago

is vimwiki_markdown available on your PATH? (what happens if you type which vimwiki_markdown ?

As mentioned at the top of the thread, this is unlikely to be a vimwiki_markdown issue, and probably more to do with where it's installed (e.g. the SUSE install changing the name of the binary). Also, https://github.com/patrickdavey/vimwiki_markdown/issues/9#issuecomment-314503073 has it working in neovim...

But, chances are that vimwiki_markdown isn't on your PATH.

NikosAlexandris commented 5 years ago

is vimwiki_markdown available on your PATH? (what happens if you type which vimwiki_markdown ?

As mentioned at the top of the thread, this is unlikely to be a vimwiki_markdown issue, and probably more to do with where it's installed (e.g. the SUSE install changing the name of the binary). Also, #9 (comment) has it working in neovim...

But, chances are that vimwiki_markdown isn't on your PATH.

Probably this is the case.

→ which vimwiki_markdown
bash: type: vimwiki_markdown: not found

Here's where it is:

→ gem which 'vimwiki_markdown'
/home/nik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown.rb

Actually, the binary is under:

/home/nik/.gem/ruby/2.4.0/bin/vimwiki_markdown

I am not sure what is best: add "$HOME/.gem" to PATH or install gem(s) under /usr/local/bin (i.e. via gem: --bindir /usr/local/bin or similar under /usr/bin)?

In fact, the following

GEM_PATH="$HOME/.gem"
export PATH="${GEM_PATH}:$PATH"

won't work as the binary(-ies) are not exactly under ~/.gem. Off-topic, but I wonder if I should add all bin sub-directories under ~/.gem?

NikosAlexandris commented 5 years ago

I manually soft-linked the binary under /usr/local/bin and here's what I get for a test page, written in Markdown:

WARNING: Nokogiri was built against LibXML version 2.9.9, but has dynamically loaded 2.9.8^@/home/nik/.gem
/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown/template.rb:24:in `initialize': No such file
or directory @ rb_sysopen - /archive/notes/vimwiki/templates/default.tpl (Errno::ENOENT)^@^Ifrom /home/nik
/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown/template.rb:24:in `open'^@^Ifrom /home/n
ik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown/template.rb:24:in `get_template_conten
ts'^@^Ifrom /home/nik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown/template.rb:9:in `i
nitialize'^@^Ifrom /home/nik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown.rb:13:in `ne
w'^@^Ifrom /home/nik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/lib/vimwiki_markdown.rb:13:in `convert_wi
kimarkdown_to_html'^@^Ifrom /home/nik/.gem/ruby/2.4.0/gems/vimwiki_markdown-0.3.3/bin/vimwiki_markdown:4:i
n `<top (required)>'^@^Ifrom /usr/local/bin/vimwiki_markdown:23:in `load'^@^Ifrom /usr/local/bin/vimwiki_m
arkdown:23:in `<main>'^@
Vimwiki: HTML conversion is done, output: /home/nik/archive/notes/vimwiki/html/

The conversion is not done. Maybe the error/warning message is mis-leading? Looks like a dependency (version) problem.

NikosAlexandris commented 5 years ago

OK, I had a mis-typed path to the default.tlp file. It works now. Although the warning message still persists.

patrickdavey commented 5 years ago

@NikosAlexandris possibly the answers https://stackoverflow.com/questions/29800482/nokogiri-was-built-against-libxml-version-2-9-1-but-has-dynamically-loaded-2-8/35481702 will help with the warning.