roggy
v0.1.3
Published
Fetch any markdown documentation as raw markdown strings
Downloads
5
Maintainers
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
, likev1.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) => {
// ...
})