Home Comments Thread
New Thread

The Ultimate Infinite Moon Reader for xaringan Slides - Instant preview without fully rebuilding HTML, and the linked navigation | /en/2019/02/ultimate-inf-mr/

yihui yihui 2022-12-17 05:39:40

The Ultimate Infinite Moon Reader for xaringan Slides - Instant preview without fully rebuilding HTML, and the linked navigation

https://yihui.org/en/2019/02/ultimate-inf-mr/

9 Comments

giscus-bot giscus-bot 2022-12-17 05:39:41
Guest *pat-s* @ 2019-02-21 08:34:12 originally posted:

Oh wow, this sounds great. Can't wait to test it!

giscus-bot giscus-bot 2022-12-17 05:39:42
Guest *Aaron Simumba* @ 2019-02-21 11:14:09 originally posted:

Another outstanding delivery Yihui! I can't wait to test the new features.

giscus-bot giscus-bot 2022-12-17 05:39:43
Guest *Romain Lesur* @ 2019-02-22 01:57:26 originally posted:

This is absolutely awesome!
This reminds me this old unanswered SO question.
When I discovered the remarkable scrolling feature, I wondered whether it can be implemented in R Markdown. The remarkable implementation is not too complex, but I cannot figure out how to do the trick.

@RLesur

yihui yihui 2022-12-17 05:39:50

As I mentioned in the post, the key challenge is to establish the map between source lines and output. One way to do it for general HTML output formats is to add special markers as HTML comments to the Rmd source, e.g., <!-- data-line=1 -->A paragraph. The comments will be preserved in the HTML output. Then we can search these for markers as we scroll in the source. The tricky thing here is to make sure not to add such comments to verbatim code blocks.

A less precise way is to "flatten" the source lines by removing any formatting, and match pure text in the HTML output (element.innerText). Or only match section headers, which might be enough.

Anyway, this is certainly trickier than the case of slides, so I only tackled the easier task.

Originally posted on 2019-02-22 03:36:54

giscus-bot giscus-bot 2022-12-17 05:39:44
Guest *Obryan Poyser* @ 2019-02-22 15:20:12 originally posted:

Nice work!!!

giscus-bot giscus-bot 2022-12-17 05:39:45
Guest *Evil Mammoth* @ 2019-02-23 23:09:18 originally posted:

This looks fantastic! Been meaning to check out xaringan, and this was the push I needed.

For some reason, I can't get the live preview to work. I have the RStudio Preview installed and set options(servr.interval = 0.5) before running inf_mr(). The slides re-render only when I save the .Rmd document. I'm on Windows 10 Pro.

giscus-bot giscus-bot 2022-12-17 05:39:50
Guest *Evil Mammoth* @ 2019-02-23 23:13:18 originally posted:

... okay, so not two minutes later, I deleted all existing text and started entering my slide content. Live preview started to work. Awesome! Thank you again.

giscus-bot giscus-bot 2022-12-17 05:39:46
Guest *Pablo Cabrera* @ 2019-02-26 16:16:09 originally posted:

Hi Yihui. Thanks very much for this developement, it is quite useful. I'm trying to use the infinite add in in R-studio with Windows and I get this error:

Error in server_config(dir, ..., baseurl = baseurl) :
unused argument (ws_handler = pkg_resource("js", "ws-handler.js"))

I'm sorry if this is very basic but I'm new and I have been looking for a solution for two days with no luck. Thanks in advance. Pablo.

yihui yihui 2022-12-17 05:39:51

That means the servr package was not successfully installed from Github. In theory, remotes::install_github() should take care of that. I don't know why it failed. Anyway, please restart R and try remotes::install_github('yihui/xaringan', upgrade = TRUE) again. If it still fails, try remotes::install_github('yihui/servr') and restart R.

Originally posted on 2019-02-26 16:23:54

giscus-bot giscus-bot 2022-12-17 05:39:52
Guest *Pablo Cabrera* @ 2019-02-26 16:51:08 originally posted:

That was the problem, I had to reinstall servr. Thanks very much, very appreciated.

giscus-bot giscus-bot 2022-12-17 05:39:47
Guest *Danilo Freire* @ 2019-03-03 18:54:42 originally posted:

Wow, this is fantastic! I can confirm it works very well on macOS. Many thanks!

giscus-bot giscus-bot 2022-12-17 05:39:47
Guest *Liechi Zhang* @ 2019-05-10 03:57:19 originally posted:

Hi, I am just wondering whether it is possible (or a good idea) to implement this magic to blogdown (or bookdown)? I think it might be quite useful for revising posts (or book chapters) locally on RStudio.

Added 3 min later:
I just saw the comment from Romain Lesur. I think we basically talked about the same thing. And now I understand it is not an easy thing to achieve.

@liechi

yihui yihui 2022-12-17 05:39:53

For blogdown, yes, the live-preview can be lightening fast if you use the method mentioned here: https://bit.ly/2018-blogdown#20 (full documentation: https://bookdown.org/yihui/blogdown/livereload.html ).

For bookdown, it cannot be so fast, but it shouldn't be too bad: https://bookdown.org/yihui/bookdown/serve-the-book.html

Originally posted on 2019-05-10 04:14:34

giscus-bot giscus-bot 2022-12-17 05:39:54
Guest *Liechi Zhang* @ 2019-05-10 04:42:37 originally posted:

That's great!
You're right, these two options in blogdown are definitely worth $580 out of $600 : ). Thanks a lot for the great design and sharing. I am not a heavy bookdown user, but I will try it to write my work note.

@liechi

giscus-bot giscus-bot 2022-12-17 05:39:48
Guest *Michael Caselli* @ 2019-09-09 14:42:29 originally posted:

In the ~7 months since this post, have these new features made it into RStudio or xaringan releases? Or are preview distributions still required?

yihui yihui 2022-12-17 05:39:54

The newer version of xaringan has been on CRAN for a few months.

For RStudio, it depends on whether you currently have problems with previewing slides on Windows. If not, you can stay with your current version of RStudio.

Originally posted on 2019-09-10 03:05:26

Sign in to join the discussion

Sign in with GitHub