twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
994 stars 61 forks source link

Shell code works with `bash` but not `sh` #331

Closed fredrik-hammar closed 5 months ago

fredrik-hammar commented 5 months ago

This is not a huge issue but it was surprising to me because Obsidian recognizes the syntax in Edit Mode, but there's no Run button in Read Mode. Also the syntax highlighting disappears, but this seems to be a perhaps related Obsidian problem.

Source mode

```sh
echo hello
echo hello

## Edit mode
![image](https://github.com/twibiral/obsidian-execute-code/assets/1689969/38a4c2bc-433d-444e-8acd-36b0734f1e78)

## Read mode
![image](https://github.com/twibiral/obsidian-execute-code/assets/1689969/3b6812f3-2142-4156-8e73-d29bf202615f)
twibiral commented 5 months ago

What exactly do you mean? The syntax highlighting is not done by the extension but by obsidian.

fredrik-hammar commented 5 months ago

Sorry, forgot to finish the description after adding screenshots. The main problem is that there is no Run button in Read Mode.

I have updated the description.

fredrik-hammar commented 5 months ago

I reported the syntax issue with Obsidian.

Syntax highlighting for sh code blocks disappears in Reading View - Bug reports - Obsidian Forum

twibiral commented 5 months ago

Okay, thats really strange... Does this appear to be always the case or only in this note or under specific circumstances?

Can you please share your OS and obsidian version? Are you using any other plugins that might interfere with the execute code plugin?

fredrik-hammar commented 5 months ago

I reproduced it now in fresh vault with only Execute Code enabled.

Debug Info

SYSTEM INFO:
    Obsidian version: v1.5.3
    Installer version: v1.5.3
    Operating system: #1 SMP PREEMPT_DYNAMIC Thu, 01 Feb 2024 10:30:35 +0000 6.7.3-arch1-1
    Login status: logged in
    Catalyst license: none
    Insider build toggle: off
    Live preview: on
    Base theme: adapt to system
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 1
    Plugins enabled: 1
        1: Execute Code v1.10.0

RECOMMENDATIONS:
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
twibiral commented 5 months ago

Okay, it looks like there is a problem with the alias sh (with both Obsidian and the plugin) but it seems to work when you use shell instead. Would that be a problem?

fredrik-hammar commented 5 months ago

That's fine with me :)

I think this is an issue in Obsidian anyway. So let's close, and I'll reopen if upstream issue gets fixed and problem still remains.