ITADN

Unfenced code with backticks being interpreted as command?

#67Opendiegonehab 创建于 2024-05-22
bug
D
diegonehabcommented
Thank you for your work and I apologize if this is an obvious mistake on my part. I was expecting `mdsh` to leave unfenced code alone. For example, in a file containing ~~~ `leave-me-alone` `$ echo 1` ~~~ I would expect the output to be ~~~ `leave-me-alone` `$ echo 1` ``` 1 ``` ~~~ Instead, I get ~~~ Using input=File("input.md") output=StdHandle work_dir=Parent("/tmp") clean=false frozen=false `leave-me-alone` thread 'main' panicked at src/main.rs:414:25: WTF, not supported note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ~~~ This `panic!("WTF, not supported")` is there becasue `mdsh` expects `leave-me-alone` to be a `RE_MATCH_FENCE_COMMAND`, a `RE_MATCH_MD_COMMAND`, or a `RE_MATCH_VAR_COMMAND`, which of course it isn't. Instead of panicking, shouldn't the code simply leave the `original_line.to_string()` in place undisturbed? After all, there was no fence there.
1 条评论