obsidian-slides-extended
obsidian-slides-extended copied to clipboard
Make this extension easier to maintain by increasing extensibility
I've been digging into some source code because I need advanced customization, and I think there could be a way to give people more power to extend Slides however they wish while also lowering the maintenance time for this specific package.
I think a lot of limitations from this library come from Reveal.js and its out-of-the-box plugins, especially as configured in this Obsidian plugin. When people are asking to customize this extension, they're often asking to customize its dependencies rather than it itself.
This plugin should offer useful defaults, and that's great for many users, but also give the ability to completely override anything. Really the most valuable thing this plugin does is its integration with Obsidian. Everything else, like the Reveal.initialize stuff, is stuff that I imagine many people would want to write themselves anyway.
In the meantime, I've actually written a node.js script that injects my own code into reveal.html and it's so awesome to have CONTROL over my slides. My syntax highlighting is no longer stupid because I'm not relying on Highlight.js anymore; I can copy AutoAnimate code and use GSAP's Flip animation instead; I can do so many cool things, and I still don't have to touch the Obsidian integration. It's still a work in progress, but the freedom is amazing, and I wish I didn't need my own node.js script to do it.
So, I think this library could free itself of the burden of maintaining ALL lower levels while also giving users more freedom to extend slides however they want. When people open an issue, you can refer them to Reveal.js documentation or some plugin instead of having to be responsible for everything that happens here.
A draft PR with your script (or just add it here), would be useful.
I don't think that would be a great idea because it's really hacky. It was meant as a short-term solution. What I think would be ideal is if there was a setting to allow a different template. There is a setting for a template, but that's for each individual slide. What I would like is a configuration option that allows specifying a path to a different reveal.html. Edit: I guess this would only make certain people happy. For people who want customization, it would make them happy. But if they want more customization, then they're probably building custom plugins and stuff. And they are probably happy to figure out their own build process for replacing the default reveal.html.
Attach here or as a draft PR ;) It will give me a better idea of what you mean and how you approached it.
@mfp22 Just post it here. Don't hide it!
Btw: people who want full control can simply just use reveal.js without this plugin. But it would be nice to implement some options inside Slide Extended options.
@ebullient: I don't know if its possible to load plugins in the yaml block? Let's say I simply want to load:
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://d3js.org/d3-request.v1.min.js"></script>
<script src="https://d3js.org/d3-queue.v3.min.js"></script>
<script src="https://d3js.org/topojson.v3.min.js"></script>
<script src="https://gist.githack.com/rajgoel/000f227d1f9c79b6f8a4225e8c9a49ba/raw/globe.js"></script>
to use it in my slides:
<div class="anything">
<!-- { "initialize": "function(container,options) {globe(container);}" } -->
</div>
Could this be possible like simply adding:
---
plugins:
- <script src="https://d3js.org/d3.v5.min.js"></script>
- <script src="https://d3js.org/d3-request.v1.min.js"></script>
- <script src="https://d3js.org/d3-queue.v3.min.js"></script>
- <script src="https://d3js.org/topojson.v3.min.js"></script>
- <script src="https://gist.githack.com/rajgoel/000f227d1f9c79b6f8a4225e8c9a49ba/raw/globe.js"></script>
---
to the frontmatter?
It's on my list of things to do, but basically... I'm using fs to write to reveal.html a string from str.replace (I find where reveal.initialize happens and insert my code before it) to include a file I read with fs, which is the script I'm including. It's just super basic and unmaintainable node.js hacks.
@mfp22 Just post it here. Don't hide it!
Btw: people who want full control can simply just use reveal.js without this plugin. But it would be nice to implement some options inside Slide Extended options.
@ebullient: I don't know if its possible to load plugins in the yaml block? Let's say I simply want to load:
<script src="https://d3js.org/d3.v5.min.js"></script> <script src="https://d3js.org/d3-request.v1.min.js"></script> <script src="https://d3js.org/d3-queue.v3.min.js"></script> <script src="https://d3js.org/topojson.v3.min.js"></script> <script src="https://gist.githack.com/rajgoel/000f227d1f9c79b6f8a4225e8c9a49ba/raw/globe.js"></script>to use it in my slides:
<div class="anything"> <!-- { "initialize": "function(container,options) {globe(container);}" } --> </div>Could this be possible like simply adding:
--- plugins: - <script src="https://d3js.org/d3.v5.min.js"></script> - <script src="https://d3js.org/d3-request.v1.min.js"></script> - <script src="https://d3js.org/d3-queue.v3.min.js"></script> - <script src="https://d3js.org/topojson.v3.min.js"></script> - <script src="https://gist.githack.com/rajgoel/000f227d1f9c79b6f8a4225e8c9a49ba/raw/globe.js"></script> ---to the frontmatter?
This is something I can look at, yes.
I try to keep up with latest reveal.js. What could also be possible is to specify this in plugin settings.. that would be easier for the plugin to deal with, I think.
Either a URL (as you have above), or local files in assets directory. Which I have to sort out. There is CSS/theme resolution magic left over from advanced slides that doesn't make a lot of sense.
It's on my list of things to do, but basically... I'm using fs to write to reveal.html a string from str.replace (I find where reveal.initialize happens and insert my code before it) to include a file I read with fs, which is the script I'm including. It's just super basic and unmaintainable node.js hacks.
Coming back to this.. Please share your horrible hack. I want to see it. ;)