obsidian-custom-js icon indicating copy to clipboard operation
obsidian-custom-js copied to clipboard

How can I use functions like normalizePath() in a script?

Open Oneechan69 opened this issue 2 years ago • 2 comments

To use normalizePath() in a plugin, you need to import it with import { normalizePath } from 'obsidian';. That doesn't work in a script (or at least an invocable one. I looked at but I couldn't figure out how else to add it.

Oneechan69 avatar Nov 17 '23 12:11 Oneechan69

See this workaround: https://forum.obsidian.md/t/expose-obsidian-module-to-be-used-outside-plugins/49988/2

dleeftink avatar Mar 10 '24 04:03 dleeftink

@Oneechan69

The easiest is to use customJS.obsidian.normalizePath()

More difficult but more powerful way is to use https://github.com/mnaoumov/obsidian-fix-require-modules/

mnaoumov avatar May 21 '24 16:05 mnaoumov