jon-heard / obsidian-inline-scripts

Obsidian plugin: Type text shortcuts that expand into javascript generated text.
MIT License
134 stars 4 forks source link

Will not execute when ` symbols are involved #16

Closed roleforgaming closed 2 years ago

roleforgaming commented 2 years ago

I'm combining the Obsidian Dice Roller with Text Expander JS (or hoping to) and want to create shortcuts that return the dice formulas, however when ` symbols are included, Text Expander throws the error Shortcut Unidentified.


Example: In a properly linked .md file that has been added as a shortcut file successfully and has successfully run the "test" script.

~~ rollcostmods ~~ return "dice: [[Items#^table-costmods]]"; ~~

I attempt to execute the shortcut by typing ;;rollcostmods; and it throws the error Shortcut Unidentified: rollcostmods


I have deduced it has everything to do with the native code symbols. I am unable to change the way the dice roller is formatted; is there any way to get this to work with Text Expander?

jon-heard commented 2 years ago

I entered this shortcut you provided and did not see an issue when expanding it.

Do you see any errors in the console (ctrl-shift-i)? If not, try running the command again and, if you still see no errors, then try opening the Text Expander JS settings.

If that doesn't work, try adding a simple test shortcut before and after the one that isn't working. See if they work. Something like:

~~ test1 ~~ return "test1 successful"; ~~

jon-heard commented 2 years ago

One other thing: check to make sure that the shortcut in your post is the same as the shortcut that is not working for you. It's possible that github's markdown parser is messing up the text of the shortcut in some way.

roleforgaming commented 2 years ago

I feel so silly. After much troubleshooting my issues stemmed from the fact that I was testing the shortcuts within the shortcut file itself. Once placed the shortcuts, by themselves in a file, and then tested in a blank file, it was working. I feel dumb. Thank you for your patience!

jon-heard commented 2 years ago

Heh. No worries. I've definitely done that before myself. Thank goodness there's undo.