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

Added new plugin rmd_reader #265

Merged
merged 1 commit into from Aug 22, 2014

Conversation

Projects
None yet
3 participants
@wilsonfreitas
Contributor

wilsonfreitas commented Aug 13, 2014

This plugin helps creating posts directly from knitr's RMarkdown files.

@justinmayer

This comment has been minimized.

Show comment
Hide comment
@justinmayer

justinmayer Aug 21, 2014

Member

Might be best to squash these into a single commit.

Member

justinmayer commented Aug 21, 2014

Might be best to squash these into a single commit.

New plugin rmd_reader
rmd_reader plugin handles Rmd files.
This is a Markdown extension with chuncks of R code.
@wilsonfreitas

This comment has been minimized.

Show comment
Hide comment
@wilsonfreitas

wilsonfreitas Aug 22, 2014

Contributor

Done!

Contributor

wilsonfreitas commented Aug 22, 2014

Done!

@justinmayer

This comment has been minimized.

Show comment
Hide comment
@justinmayer

justinmayer Aug 22, 2014

Member

Thanks for the contribution, Wilson!

Member

justinmayer commented Aug 22, 2014

Thanks for the contribution, Wilson!

justinmayer added a commit that referenced this pull request Aug 22, 2014

@justinmayer justinmayer merged commit 3938a8b into getpelican:master Aug 22, 2014

@rjweiss

This comment has been minimized.

Show comment
Hide comment
@rjweiss

rjweiss Aug 26, 2014

Seems like there are some expectations about how you've set up your paths and where your .Rmd files need to be if you want to use knitr's graphics embedding functions. Am I wrong?

rjweiss commented Aug 26, 2014

Seems like there are some expectations about how you've set up your paths and where your .Rmd files need to be if you want to use knitr's graphics embedding functions. Am I wrong?

@wilsonfreitas

This comment has been minimized.

Show comment
Hide comment
@wilsonfreitas

wilsonfreitas Aug 29, 2014

Contributor

I use that plugin in my blog as it is, without extra settings.
I will investigate rpy2 for some configuration path.
I simply put the .Rmd files inside content directory, and I use settings.DEFAULT_CONFIG.get('PATH') + '/content' in my code to have that set.

Indeed, there is an extra step that I've forgotten to mention in order to get the images src properly set.
You need to paste that code inside your .Rmd file.

```{r, echo=FALSE}
hook_plot <- knit_hooks$get('plot')
knit_hooks$set(plot=function(x, options) {
    if (!is.null(options$pelican.publish) && options$pelican.publish) {
        x <- paste0("{filename}", x)
    }
    hook_plot(x, options)
})
opts_chunk$set(pelican.publish=TRUE)
```

Without that your images don't appear. I'll document that.

Contributor

wilsonfreitas commented Aug 29, 2014

I use that plugin in my blog as it is, without extra settings.
I will investigate rpy2 for some configuration path.
I simply put the .Rmd files inside content directory, and I use settings.DEFAULT_CONFIG.get('PATH') + '/content' in my code to have that set.

Indeed, there is an extra step that I've forgotten to mention in order to get the images src properly set.
You need to paste that code inside your .Rmd file.

```{r, echo=FALSE}
hook_plot <- knit_hooks$get('plot')
knit_hooks$set(plot=function(x, options) {
    if (!is.null(options$pelican.publish) && options$pelican.publish) {
        x <- paste0("{filename}", x)
    }
    hook_plot(x, options)
})
opts_chunk$set(pelican.publish=TRUE)
```

Without that your images don't appear. I'll document that.

@rjweiss

This comment has been minimized.

Show comment
Hide comment
@rjweiss

rjweiss Aug 29, 2014

Alternatively, since you're knitting anyway, if you know where the figure directory will be relative to your rendered .Rmd page, you can just hard-set it:

e.g.

opts_chunk$set(fig.path = "../../../figure/", echo = FALSE, warning = FALSE, 
    message = FALSE)

That's what ended up working for me.

rjweiss commented Aug 29, 2014

Alternatively, since you're knitting anyway, if you know where the figure directory will be relative to your rendered .Rmd page, you can just hard-set it:

e.g.

opts_chunk$set(fig.path = "../../../figure/", echo = FALSE, warning = FALSE, 
    message = FALSE)

That's what ended up working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment