Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some suggestions ... #5

Open
pjheslin opened this issue Nov 19, 2022 · 2 comments
Open

Some suggestions ... #5

pjheslin opened this issue Nov 19, 2022 · 2 comments

Comments

@pjheslin
Copy link

I've just started using Remark, and remark-mode is great! Here are a couple of observations from a new user.

I want to customize the appearance of my slides, so I set the value of remark--folder in my init file to a folder with a customized version of the skeleton file remark.html. I was surprised to find that remark-mode also uses this as the location it looks for server.js. It was easy enough to copy it to my new folder, but it seems like that server.el is an integral part of your mode, whereas the skeleton is something most users will want to customize. Would it make sense to split remark--folder into two different variables for setting the location of these two very different files?

I often have several related slideshows in one folder and I would prefer to generate an html file for each, instead of using index.html for all of them. Would you consider a configurable option to have remark-mode use the basename of the remark file and add ".html" to it? So that foo.remark would generate foo.html?

@pjheslin
Copy link
Author

I forgot ... there was one more thing. It seems that remark-mode looks in the current directory and if it finds an index.html it uses that as a template instead of the global template. I can see how that is useful if you want to have per-directory templates. But it means that if you are tweaking the global template, you have to keep deleting index.html in order to pick up the new changes to the global template, which I found confusing.

Would it be better to separate the two purposes that index.html currently serves by using two different files for those different purposes? I would suggest that if there is a file called remark.html in the current directory, remark-mode would use that as the template instead of the global one. The index.html (or other basename) file would only be used for output.

@torgeir
Copy link
Owner

torgeir commented Nov 23, 2022

Thanks, I'm glad you enjoy it!

Yes, remark--folder was not intended for user customization, hence the -- in the filename, which is often used to denote "private areas" of elisp code, not part of the api. Well, as close you can get to private, that is, with everything being globally available.. Modifying it will break, as the rest of the module expects to find its internal files next to remark-mode.el, as you note.

My personal motivation for this mode was to make the fastest way I could think of to get me from markdown content to slides served on the web, e.g. on github pages, which is what I usually default to. This is why I opted for customizability through actually changing the outputted index.html, e.g. to add css changes, that will persist across changes to your slides. As a bare minimum I commit the slides.remark file and the index.html file in a repo, turn on github pages, and the slides are readily available. The base remark.html from the installation folder will only be used if there is no index.html in the slideshow folder.

I definitely agree on your suggestion of providing the ability to use an external remark.html, e.g. to enable sharing a theme of yours across your slideshows. I pushed a new version now that adds remark-skeleton-file that will override an existing index.html if it is set, please try it out!

While I like the idea of multiple slideshows in the same folder, and naming the output files based on the <slideshow>.remark file, I need to think through the consequences, e.g. of the state file .slide and sharing a single server across multiple slideshows, and how it can be done without breaking existing slideshows. I know myself I have quite a few repos with a file slides.remark where I expect an index.html to make a slideshow work out of the box on github, with "pretty urls" like this https://torgeir.github.io/graphql-talk/ on github pages. Maybe a folder <slideshow>/ could be output for each <slideshow>.remark in the folder, which would then scope the state file and each index.html file, still making for folders navigable on the web with pretty urls. Dunno, I have to think about that.

Edit: I guess you could use .dir-locals.el to set remark-skeleton-file to a local remark.html file if you don't care for a single share template across all your slideshows, but rather one per a set of folders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants