Reader view in Publish using cssClasses

I have created a script to activate a “reader view” on an Obsidian Publish site, it works with sliding windows or without (but I have not tested it with sidebar disabled by default).

This view can be useful to visualize poetic texts or to browse through images as a portfolio or simply to have a clearer view while reading. Now you can activate the “reading view” in 4 different ways:

  • using a button
  • pressing the “r” key
  • by defining the reader-view class in the cssClass property in the frontmatter
  • adding ?reader=true to the url of the page.

I have implemented the script on my Publish website.

Here an example activating the script via url, where you can find the code (also on Github)

2 Likes

This is brilliant, and it needs more attention.

I wonder if it’s worth it/possible to also reduce the alpha on scrollbars in this view so they are less obtrusive.

2 Likes

This was exactly what I was wondering about. It would be great to have a scrollable one, but it doesn’t seem very easy. I also noticed the image modals in yours if you click on an image. This was another issue I ran into when sharing tutorials where the images are quite large.

Thanks a lot!

1 Like

You mean when Reader view is activated? Yes, I had put myself but I did not finish closing, I will do it soon.

Great! Looking forward to seeing it.

By default Publish displays scrollbars only when scrolling. I have been able to customize the look of the scrollbars but by adding any css selector, the bars are always displayed, even when you do not scroll: at this point it becomes meaningless I guess. I would have to understand how the web works (maybe it’s a css transition?) but I don’t know if it’s worth it: with Safari and Chrome the scrollbar is almost imperceptible, it becomes temporarily intrusive when you click on it but it is a brief moment…

Is it the same behavior for you?