The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
conflr is an R package to post R Markdown documents to Confluence, a content collaboration tool by Atlassian.
Install conflr from CRAN with:
install.packages("conflr")
Alternatively, if you need the development version, install it with:
# install.packages("devtools")
::install_github("line/conflr") devtools
conflr uses these environmental variables to access your Confluence.
CONFLUENCE_URL
: The base URL of your Confluence. e.g.
https://confluence.example.com
(On Atlassian Cloud,
https://<your-domain>.atlassian.net/wiki
).CONFLUENCE_USERNAME
: Your username (On Atlassian Cloud,
your email address).CONFLUENCE_PASSWORD
: Your password (On Atlassian Cloud,
your API token. For more details about API token, please read the
official document).There are several ways to set these environmental variables. The quickest way is to enter in the popups that are displayed when you run the addin (see Usages section below). The inputs are cached in the environmental variables listed above by default.
Another way is to set the variables in the .Renviron
file (you can open the file with
usethis::edit_r_environ()
). For example, you can set the
base URL in the file as the following.
CONFLUENCE_URL=https://confluence.example.com
conflr provides the following ways to post R Markdown documents to Confluence.
confl_create_post_from_Rmd()
on consoleconflr::confluence_document
on the YAML
front-matter(Caution for those who are not familiar with R Markdown: R Markdown’s powerfulness allows you to execute arbitrary code; be sure about what the code does before clicking “Post to Confluence”!)
Then, you will be asked your username and password.
confl_create_post_from_Rmd()
If you don’t use RStudio, you can use
confl_create_post_from_Rmd()
. The basic usage is
confl_create_post_from_Rmd("~/path/to/your.Rmd")
If you want to use this function without interaction, specify
interactive = FALSE
. This skips any confirmations or
previews.
confl_create_post_from_Rmd("~/path/to/your.Rmd", interactive = FALSE)
Note that, if you want to run this periodically, you also need to set
update = TRUE
to allow conflr to overwrite the existing
page.
confl_create_post_from_Rmd("~/path/to/your.Rmd", interactive = FALSE, update = TRUE)
conflr::conflence_document
conflr’s functionality is also available as a custom R Markdown
format; You can specify conflr::confluence_document
to
output
in the front matter of your R Markdown document.
For example, if you set the following front matter, pressing
Knit
button on RStudio (or running
rmarkdown::render()
) will publish the R Markdown document
to Confluence.
---
title: "title1"
output:
conflr::confluence_document:
space_key: "space1"
update: true
---
...
For the detail about available options, please refer to ?confluence_document
.
conflr recognizes these options:
conflr_supported_syntax_highlighting
: A character
vector of languages that your Confluence supports the syntax
highlighting in addition to the default languages (by default,
sql
, cpp
, python
,
html
, css
, bash
, and
yaml
are supported).conflr_addin_clear_password_after_success
: If
TRUE
, unset CONFLUENCE_PASSWORD
after the page
is successfully uploaded via addin.conflr supports Math expressions to some extent. But, it requires LaTeX Math addon installed. Otherwise, you will see “unknown macro” errors on the page.
conflr doesn’t support htmlwidgets-based packages like leaflet and
plotly. Instead, you can embed the screenshot by setting
screenshot.force = TRUE
in the chunk option (c.f. https://bookdown.org/yihui/bookdown/html-widgets.html).
conflr is also a (non-complete) binding to Confluence’s REST API. These low-level functions might be useful when you need to access to your Confluence programmatically.
library(conflr)
# list pages
<- confl_list_pages(spaceKey = "foo")
res ::map_chr(res$results, "id")
purrr
# get page info
<- confl_get_page(res$results[[2]]$id)
page $title
page
# create a page
<- confl_post_page(
new_page spaceKey = "foo",
title = "Test",
body = glue::glue(
'<ac:structured-macro ac:name="code">
<ac:plain-text-body><![CDATA[this is my code]]></ac:plain-text-body>
</ac:structured-macro>
'))
$`_links` new_page
See CONTRIBUTING.md
Copyright (C) 2019 LINE Corporation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
See LICENSE.md for more detail.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.