chipsenkbeil / vimwiki-rs

Rust library and tooling to parse, render, and modify vimwiki text and files.
56 stars 2 forks source link

Error on `vimwiki convert` when an output directory is missing #115

Closed brennen closed 3 years ago

brennen commented 3 years ago

With vimwiki-cli built from ccd3119. On first running convert, I was getting this:

21:56:36 brennen@inertia:~/notes (master *$%>) ✮ vimwiki convert ~/notes/vimwiki/index.wiki         
ERROR - Failed to load vimwiki_list from vim/neovim: invalid value: string "/home/brennen/notes/markdownwiki/html/", expected No such file or directory (os error 2)

Took me a minute to realize that it probably just wanted ~/notes/markdownwiki/html (as specified in config) to exist.

chipsenkbeil commented 3 years ago

@brennen, it's supposed to create that directory for you, but I think I have a check floating somewhere that tries to canonicalize the path when first being fed in and it's probably failing as you said. Let me see if I can check in a fix in a little bit.

Migrating some internal code over to https://github.com/chipsenkbeil/vimvar-rs

chipsenkbeil commented 3 years ago

@brennen, see if https://github.com/chipsenkbeil/vimwiki-rs/commit/5443ff17c8416d6534fa33d088db309667326f42 fixes the issue.

brennen commented 3 years ago

No longer fails if ~/notes/markdownwiki/html doesn't exist, but I'm also not sure if it's finding the config for that wiki. Can't get it to produce output for ~/notes/markdownwiki/index.md at all.

Edit: Config, for reference:

    " main personal wiki
    let wiki = {}
    let wiki.name = 'notes'
    let wiki.path = '~/notes/vimwiki/'
    let wiki.path_html = '~/workspace/notes-html/'
    let wiki.auto_tags = 1
    let wiki.auto_diary_index = 1
    let wiki.automatic_nested_syntaxes = 1

    " a markdown wiki for testing purposes
    let markdownwiki = {}
    let wiki.name = 'markdownwiki'
    let markdownwiki.path = '~/notes/markdownwiki'
    let markdownwiki.path_html = '~/notes/markdownwiki/html/'
    let markdownwiki.auto_tags = 1
    let markdownwiki.auto_diary_index = 1
    let markdownwiki.automatic_nested_syntaxes = 1
    let markdownwiki.syntax = 'markdown'
    let markdownwiki.ext = '.md'

    let g:vimwiki_list = [wiki, markdownwiki]
chipsenkbeil commented 3 years ago

@brennen, what do you see for vimwiki convert -vvvv at the beginning with regard to g:vimwiki_list? Should reflect what it has read there.

image
brennen commented 3 years ago
21:39:15 brennen@inertia:~/code/chipsenkbeil/vimwiki-rs (master=) ✾ vimwiki convert -vvvv
TRACE - load_html_config(path = None, include = [], merge = false, extra_paths = [])
TRACE - load_vimwiki_list()
TRACE - g:vimwiki_list == Some(Array([Object({"path_html": String("~/workspace/notes-html/"), "auto_tags": Number(1), "name": String("markdownwiki"), "automatic_nested_syntaxes": Number(1), "auto_diary_index": Number(1), "path": String("~/notes/vimwiki/")}), Object({"path_html": String("~/notes/markdownwiki/html/"), "auto_tags": Number(1), "path": String("~/notes/markdownwiki"), "ext": String(".md"), "automatic_nested_syntaxes": Number(1), "auto_diary_index": Number(1), "syntax": String("markdown")})]))
TRACE - load_ast(_, include = [], cache = "/home/brennen/.cache/vimwiki-cli", no_cache = false, no_prune_cache = false)
DEBUG - Loading wiki @ index = 0 | name = Some("markdownwiki") from "/home/brennen/notes/vimwiki"
chipsenkbeil commented 3 years ago

Oh, wait, I just realized that you said it's for markdown files. This doesn't support markdown files right now. Only vimwiki syntax.

brennen commented 3 years ago

Oh, wait, I just realized that you said it's for markdown files. This doesn't support markdown files right now. Only vimwiki syntax.

D'oh, yep. I didn't have any expectations that it would support Markdown, but I think I bounced into assuming it would do something here from the original error caused by the missing dir for that wiki without passing through the "that's markdown" segment of reality. Not at my sharpest this weekend.

chipsenkbeil commented 3 years ago

@brennen it should try to process as vimwiki if the extension is set to the files.

image image
chipsenkbeil commented 3 years ago

Might be worth a separate issue if you're not seeing your wiki that has the extension set to markdown actually attempt to process the files.