mdsh icon indicating copy to clipboard operation
mdsh copied to clipboard

Unfenced code with backticks being interpreted as command?

Open diegonehab opened this issue 1 year ago • 1 comments

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.

diegonehab avatar May 22 '24 15:05 diegonehab

It's not you, this is a bug!

zimbatm avatar May 22 '24 19:05 zimbatm