roggy

Fetch any markdown documentation as raw markdown strings

Usage no npm install needed!

<script type="module">
  import roggy from 'https://cdn.skypack.dev/roggy';
</script>

README

roggy

Install

yarn add roggy
# or
npm install roggy

Programmatic Usage

Require the function call it with any of the following:

  • A remote branch name like master
  • A version number, like 3.0.0
  • A version number that starts with a v, like v1.0.0
  • A commit SHA, like 74603dec82800abe2f313d8edace189836d93432
  • A local directory, like ~/my/path/to/something-great

Also you need provide owner and repository. Example:

import { roggy } from 'roggy'

const docs = await roggy('master', {
  owner: 'electron',
  repository: 'electron',
})
docs.forEach((doc) => {
  // docs is an array of objects, one for each markdwon file in /docs
})

Each object in the array looks like this:

{
  slug: 'chromium-rce-vulnerability',
  filename: 'chromium-rce-vulnerability.md',
  markdown_content: '---\ntitle: Chromium RCE Vulnerability Fix\nauthor: zeke\ndate: ' +
}

When fetchhing docs from a local directory, be sure to use a full path:

import * as path from 'path'
const docsPath = path.join(__dirname, 'docs')

roggy(docsPath, { owner: '', repository: '' }).then((docs) => {
  // ...
})

License

MIT