Hi,
I will happily reward anyone who can either answer in detail here or publish an article or series of articles.
What I’m trying to do
I’m trying to use Obsidian, Custom CSS and Custom JS for mission-critical work related communication, so futzing around and going down rabbit holes trying to understand the idiosyncrasies is not something I can keep doing.
Things I have tried
I have read the Obsidian official documentation, many other articles and posts, and the code for both Themes and Plugins.
I have been down rabbit holes trying to make it all work together, and I seem to be doing it wrong. I have tried Plugins such as RunJS, JS-Engine, Dataview, and the like. At this point I have lost days of work time. I can’t keep losing time.
Specific Questions:
- Where can I put environment variables that will allow me to use private API keys in my JavaScript? If this was a normal JS project in any framework, there would be a .env file in the root directory, and a library would import constants from it as environment variables such as OPENGRAPH_API_KEY. Given I am using Publish, I need to know where I can put these environment variables so the JavaScript works in Publish, but the key is not exposed.
- How are CSS selectors called from the Markdown syntax that Obsidian uses? If I have a class or id selector, where does it go in embedded markdown? (For context, it’s been impossible for me to figure out how to use Markdown to make CSS for a Carousel that works both in Edit mode and also on the Publish site.
- If I want to use modular CSS, how can I make sure that styles are applied consistently from the publish.css file and the .obsidian/snippets/ files?
- If I want to use modular JS, how can I make sure that functions and classes that are set up in a js/custom/ directory can be called from a markdown file in both Edit and in Publish mode? How do I call JS functions in both Markdown syntax and in raw HTML embeds?
I am a proficient web developer, so I know how to do these things on an independent website.
What I am missing is the exact syntax and the exact directory structure. The Obsidian documentation is not specific enough to be helpful for me.
Will reward a good answer.