Code Monkey home page Code Monkey logo

conflr's Introduction

conflr

Travis build status

conflr is an R package to post R Markdown documents to Confluence, a content collaboration tool by Atlassian.

Installation

You can install conflr from GitHub.

# install.packages("devtools")
devtools::install_github("line/conflr")

Preparation

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 install command (see Usages section below).

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

Usage

1. Move focus to the .Rmd file and click “Post to Confluence” Addin

(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.

2. Check the preview and click “Publish”

  • type: The type of the page (page means a normal wiki page, whereas blogpost mean a blog post, not a page).
  • Space Key: The key of the space you want to post.
  • Parent page ID: (optional): The ID of the parent page to the page.

3. Check the result

Know limitations

LaTeX support

conflr supports Math expressions to some extent. But, it requires LaTeX Math addon installed. Otherwise, you will see “unknown macro” errors on the page.

htmlwidgets (e.g. leaflet, plotly)

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).

Usage in console

library(conflr)

# list pages
res <- confl_list_pages(spaceKey = "foo")
purrr::map_chr(res$results, "id")

# get page info
page <- confl_get_page(res$results[[2]]$id)
page$title

# create a page
new_page <- confl_post_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>
    '))
new_page$`_links`

How to contribute

See CONTRIBUTING.md

License

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.

conflr's People

Contributors

ellisvalentiner avatar yutannihilation avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.