mps9506 / blogdown-tufte

Theme for Hugo+blogdown published websites. Forked from Hugo-tufte: https://github.com/shawnohare/hugo-tufte and tuftesque: https://github.com/nstrayer/tuftesque. WIP :construction:
MIT License
4 stars 0 forks source link

Shortcode issues #4

Open neeldhara opened 6 years ago

neeldhara commented 6 years ago

I am in the early stages of using blogdown-tufte and whenever I use shortcodes with arguments, I get the following error when I run blogdown::build_site():

unterminated quoted string in shortcode parameter-argument

Any hints on what I might be doing wrong will be greatly appreciated - thanks!

mps9506 commented 6 years ago

@neeldhara Thanks for raising the issue. I need to update the documentation.

The shortcodes should work fine as documented if you make a plain markdown post. However, when using shortcodes in rmarkdown you need to use blogdown::shortcode(.name, ..., .content, .type)

For example:

    ## epigraph
    ```{r echo=TRUE}
    blogdown::shortcode(.name = "epigraph", .content = "This is an example of an epigraph")
## tweets:
```{r echo=TRUE}
blogdown::shortcode("tweet", "852205086956818432")
```


![capture](https://user-images.githubusercontent.com/11282246/40678257-ac2583b8-6345-11e8-8dfb-24591a5a6578.PNG)

That said, there are clearly some formatting issues. In plain markdown, the epigraph renders math cleanly, but returns errors when using `blogdown::shortcode()`. Hopefully this helps your error messages. I'll leave this open until I figure out some of the formatting issues as well.
neeldhara commented 6 years ago

This is very helpful, thanks very much! Just to be sure, to get the output without displaying the R code that generates it, I invoke the function as an inline R snippet, and that works great:

r blogdown::shortcode(.name = "epigraph", .content = "This is an example of an epigraph")

Looking forward to the updated docs whenever you have a chance - once I find my way around a little more, I hope I can contribute too.

mps9506 commented 6 years ago

Correct. You can also include the R code as a code chunk like the the example posted above, but with echo=FALSE in the code chunk option.