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

R Markdown and Animation - Animated Plot Cuts Trail of Document #1067

Closed
s-fiebig opened this issue Jul 7, 2015 · 5 comments · Fixed by #1072
Closed

R Markdown and Animation - Animated Plot Cuts Trail of Document #1067

s-fiebig opened this issue Jul 7, 2015 · 5 comments · Fixed by #1072
Milestone

Comments

@s-fiebig
Copy link
Contributor

s-fiebig commented Jul 7, 2015

Using R Markdown to include animations cuts all content after the animation.

First of all, I'm not entirely sure if the fault is with knitr or another part of the R Markdown Toolchain, but as I've solved it temporarily in knitr, I'm posting here.

OSX
R Version 3.2.1
knitr 1.10.5
R Markdown 0.7

Using the sample from the knitr docu about animation or from stackexchange (http://stackoverflow.com/questions/12038893/combining-r-markdown-and-animation-package) with additional content results in a html with all content missing after the animated plot. E.g.:

```{r clock, fig.width=7, fig.height=6, fig.show='animate'}
par(mar = rep(3, 4))
for (i in seq(pi/2, -4/3 * pi, length = 12)) {
    plot(0, 0, pch = 20, ann = FALSE, axes = FALSE)
    arrows(0, 0, cos(i), sin(i))
    axis(1, 0, "VI"); axis(2, 0, "IX")
    axis(3, 0, "XII"); axis(4, 0, "III"); box()
}
```
Everything from here on is missing.

Reason is the wrong html that is created:

...
<source src="bob" /><p>video of chunk clock</video></p>
...

The video and p tag are disordered. I haven't found (didn't look extensively) the code part introducing the paragraph tags and solved it by adding p tags myself in

sprintf('<video %s><source src="%s" />video of chunk %s</video>',

sprintf('<video %s><source src="%s" /><p>video of chunk %s</p></video>',
@yihui
Copy link
Owner

yihui commented Jul 9, 2015

Thanks for the report. I can reproduce it. I think it is a Pandoc issue. Here is a minimal repro:

test.md

<video ><source src="foo"/>asdf</video>

Run pandoc test.md -o test.html and you get:

<video >
<source src="foo"/>
<p>asdf</video></p>

I have verified that the current latest version of Pandoc (1.15.0.4) still has the problem. I guess you can move it to https://github.com/jgm/pandoc/issues

@s-fiebig
Copy link
Contributor Author

Thanks for checking this! Will move the issue (jgm/pandoc#2290).

@s-fiebig
Copy link
Contributor Author

jgm did "not" accept this as a bug for the time being. He suggested introducing a paragraph (jgm/pandoc#2290), what is as good as writing the p tags (what I did).
I'm leaving the decision to you and don't do a pull request, unless told otherwise.
You can close the issue at your discretion.

@s-fiebig s-fiebig reopened this Jul 10, 2015
@yihui
Copy link
Owner

yihui commented Jul 10, 2015

Thanks a lot! A simple pull request adding <p></p> will be welcome :)

s-fiebig added a commit to s-fiebig/knitr that referenced this issue Jul 10, 2015
Pandoc creates disordered paragraph tags in the inner html for
video/source.
Closes yihui#1067
@yihui yihui added this to the v1.11 milestone Jul 11, 2015
yihui added a commit that referenced this issue Jul 11, 2015
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants