Repository navigation
Closed
Description
Hello, I've been using your application for a little bit now and I've grown very very attached to it. It's pretty great. I just started having this issue yesterday with no apparent catalyst.
When I run "espanso start"
I get:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/markdown-0.3.0/src/parser/block/unordered_list.rs:84:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Then when I run: "RUST_BACKTRACE=1RUST_BACKTRACE=1 espanso"
I get:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/markdown-0.3.0/src/parser/block/unordered_list.rs:84:44
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: markdown::parser::block::unordered_list::parse_unordered_list
4: markdown::parser::block::parse_blocks
5: markdown::to_html
6: <espanso::matcher::Match as serde::de::Deserialize>::deserialize
7: <serde_yaml::de::SeqAccess as serde::de::SeqAccess>::next_element_seed
8: <serde::de::impls::<impl serde::de::Deserialize for alloc::vec::Vec<T>>::deserialize::VecVisitor<T> as serde::de::Visitor>::visit_seq
9: <&mut serde_yaml::de::Deserializer as serde::de::Deserializer>::deserialize_seq
10: serde_yaml::de::Deserializer::visit_mapping
11: <&mut serde_yaml::de::Deserializer as serde::de::Deserializer>::deserialize_struct
12: serde_yaml::de::from_str
13: espanso::config::Configs::load_config
14: espanso::config::ConfigSet::load::{{closure}}
15: espanso::config::ConfigSet::load_default
16: espanso::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I have not yet uninstalled and reinstalled, but I'm wondering if that's not the only solution. Any help you can provide me would be great. I did not register with root as in another case that I saw.
Activity
KyleSnodgrass commentedon Sep 23, 2021
Re-installing didn't appear to help with the issue. There must be something else that is causing RUST to panic.
KyleSnodgrass commentedon Sep 23, 2021
I got it working. I did the following:
-Removed all .yml files in the library except the default.
-Restarted espanso -> it worked :)
-Re-added files and restarted espanso until I found the yml that was breaking it.
-This makes a good case for separating out each of your triggers into individual files.
-Once the file was located I changed the "markdown:" to "replace:" restarted espanso and it worked.
-There must be an issue with Markdown and triggers so be careful using them.
federico-terzi commentedon Sep 27, 2021
Hey @KyleSnodgrass,
Thanks for reporting this issue! This seems like a bug, would you mind sharing the
markdowncontent that triggered this exception? Any markdown that triggers that panic would be incredibly useful!Cheers :)
KyleSnodgrass commentedon Sep 28, 2021
I think I can do that. I removed a little bit of the text, but validated that it still causes the panic. I guess I should also note that this is within 2 levels of sub folders under user.
Additionally, I commended out the nested functionality and the panic still existed.
I have noted unexpected behavior from markdown in general within the confines espanso. I really do like having markdown as an option because it makes pre-made emails and the like so much more pleasant looking.
federico-terzi commentedon Sep 30, 2021
@KyleSnodgrass Thank you! I was able to reproduce the problem
It seems to be related to the "empty unordered list" you implicitly created when adding the
-char without anything afterwards.For example, the following match panics:
but this one doesn't
This error happens because the markdown package we are using is panicking under the hoods.
The good news is that this is not espanso's fault, the bad one is that we should fix the problem in the
markdownpackage, but it doesn't seem to be maintained currently...So we either fork the package and fix the bug, or we replace the package with another one. Either way, this is likely to take a while to be fixed :)
[-]Espanso won't start: "thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/markdown-0.3.0/src/parser/block/unordered_list.rs:84:44"[/-][+]Malformed markdown causes espanso to panic[/+]KyleSnodgrass commentedon Oct 4, 2021
Not a problem. I know there's only so much time in the day and that not all people use the markdown feature. However, I've been incorporating it more and more for my communications and it really elevates what you're able to automate. I prefer the markdown to the HTML, it's easier to write for a non-developer.
The markdown package that is included does tend to have a couple of issue. It changes the size of the text, and you can't adjust it within the markdown, so that's a touch annoying, but it's not the end of the world. I noted that you can change this stuff in HTML with a custom CSS file, but that doesn't seem to integrate well either. So some form of font/size control would be lovely.
Thanks for all you're doing. I love this application.
federico-terzi commentedon Oct 5, 2021
Thank you for the feedback! We'll investigate :)
fix(engine): add workaround to markdown parsing to avoid crashing esp…
federico-terzi commentedon Oct 26, 2021
This has been fixed in the new release! See: https://github.com/federico-terzi/espanso/releases
Thanks for your help :)
Fix markdown rendering with nested lists (espanso#2217)
Replace markdown library to fix nested lists rendering (#2217) (#2515)
fix(engine): add workaround to markdown parsing to avoid crashing esp…
Replace markdown library to fix nested lists rendering (espanso#2217) (…