vuepress-paper

Fetch and transform content from Dropbox Paper for Vuepress.

Usage no npm install needed!

<script type="module">
  import vuepressPaper from 'https://cdn.skypack.dev/vuepress-paper';
</script>

README

Vuepress Paper

Travis Build Status LGTM Grade Depfu Status

Node.js package to fetch content from Dropbox Paper, generate a sidebar and enhance the markdown for Vuepress.

Usage

npm install vuepress-paper --save-dev

Configuration

Generally using Vuepress Paper will take place in Vuepress configuration, for example using all three functionalities:

const { fetchPapers, generateSidebar, paperPlugin } = require('vuepress-paper');

module.exports = () => fetchPapers({
  apiToken: process.env.DROPBOX_API_TOKEN,
  directoryId: process.env.DROPBOX_PAPER_DIRECTORY_ID,
})
  .then((documentsMetaData) => ({
    themeConfig: {
      sidebar: generateSidebar(documentsMetaData),
    },
    plugins: [
      [ paperPlugin, { documentsMetaData } ]
    ],
  }));

API

fetchPapers({ apiToken, directoryId })

apiToken

Type: String

The Dropbox API access token generated from the Dropbox App Console.

directoryId

Type: Boolean

The directory to fetch content from, the ID is present at the end of a directory URL in Dropbox Paper. For example the Playbook directory URL ends with: Playbook-e.1gg8Yut8. Where e.1gg8Yut8 is the ID.

generateSidebar(documentsMetaData)

documentsMetaData

Type: Array

Information about each document that is fetched from Dropbox Paper, used to create a tree based on their location.

paperPlugin({ documentsMetaData })

documentsMetaData

Type: Array

Information about each document that is fetched from Dropbox Paper, used rewrite links that point to other generated documents.

Development

Quick start

Initial setup

git clone git@github.com:voorhoede/vuepress-paper.git
cd vuepress-paper
npm ci

Codebase overview

Testing

Unit tests are present in each file matching the implementation filename ending with .test.js and are ran with: npm test.

Style

The code is written in a functional style using Sanctuary to provide simple, pure functions with no need for null checks.