2017-08-15 41 views
1

我想知道如何在bookdown的gitbook输出格式中配置twitter按钮。如何在Bookdown中配置twitter按钮?

我couldn't找到Authoring Books and Technical Documents with R Markdown

+0

你的意思是在这里:https://bookdown.org/yihui/bookdown/html.html# gitbook风格..? – Frank

+0

嗨@gitzhuoer,我非常感谢您的帮助,但我仍然无法解决我的问题。我明白你的答案,但是一旦我配置按钮出现,我应该在哪里指定url?如果我在我的bookdown中按下twitter按钮,则不会发生任何事情。 –

+1

您需要使用Chrome等浏览器打开您的图书,而不是RStudio。你不需要指定url,你将被重定向到twitter登录页面。 –

回答

2

的回答https://bookdown.org/yihui/bookdown/html.html#gitbook-style

bookdown::gitbook: 
    config: 
     sharing: 
     facebook: yes 
     twitter: yes 
     google: no 
     weibo: no 
     instapper: no 
     vk: no 
     all: ['facebook', 'google', 'twitter', 'weibo', 'instapaper'] 

在工具栏的右侧,有一些按钮分享到社交网络网站如Twitter链接,Facebook和Google+。您可以使用sharing选项来决定启用哪些按钮。如果您想完全摆脱这些按钮,请使用sharing: null(或no)。

下面是一个小例子:

index.Rmd

--- 
title: "A Book" 
author: "Frida Gomam" 
site: bookdown::bookdown_site 
output: 
    bookdown::gitbook: 
    config: 
     sharing: 
     twitter: yes 
--- 

# reference 

This is my table \@ref(tab:mytable) 

# table 

```{r mytable, echo=TRUE} 
knitr::kable(iris[1:10, ], booktabs=T, caption='A table of the first 10 rows of the mtcars data') 
``` 

enter image description here enter image description here