Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evitanrelta/github-markdown-batch-render
To batch-render Markdown strings via GitHub's API (using Octokit/REST). For mitigating GitHub's API's request rate-limit.
https://github.com/evitanrelta/github-markdown-batch-render
batch-processing batch-rendering gfm github-api github-flavored-markdown github-markdown markdown markdown-renderer octokit
Last synced: about 1 month ago
JSON representation
To batch-render Markdown strings via GitHub's API (using Octokit/REST). For mitigating GitHub's API's request rate-limit.
- Host: GitHub
- URL: https://github.com/evitanrelta/github-markdown-batch-render
- Owner: EvitanRelta
- License: mit
- Created: 2022-10-18T13:37:05.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-19T10:24:12.000Z (about 2 years ago)
- Last Synced: 2024-12-02T04:35:46.961Z (about 2 months ago)
- Topics: batch-processing, batch-rendering, gfm, github-api, github-flavored-markdown, github-markdown, markdown, markdown-renderer, octokit
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/github-markdown-batch-render
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Batch render markdowns via GitHub-API
For batch-rendering an array of Markdown strings via GitHub's API *(using Octokit/REST)*.
Uses only 1 GitHub-API request to render all the markdown strings.
> Useful for mitigating GitHub's API's request rate-limit.
## Install
```bash
npm i github-markdown-batch-render
```
## Usage
Basic usage:
````typescript
const markdowns = [
'**bold** _italic_',
'# Title\n\nParagrapgh',
'```\nCodeblock\n```'
]
const renderedMarkdowns = await ghMdBatchRender(markdowns)
/**
* 'renderedMarkdowns' will be: [
* 'bold italic
',
* 'Title
\nParagrapgh
',
* ''Codeblock\n
* ]
*/
````
Force use an `Octokit` instance:```typescript
const octokit = new Octokit({ auth: 'personalaccesstoken' })
const renderedMarkdowns = await ghMdBatchRender(markdowns, { octokit })
```
Passing `mode` / `context` option(s) to the [`Octokit.rest.markdown.render`](https://octokit.github.io/rest.js/v19#markdown-render) method:> Note: `ghMdBatchRender`'s `mode` option defaults to `"gfm"` unlike Octokit, which defaults to `"markdown"`.
```typescript
const renderedMarkdowns = await ghMdBatchRender(markdowns, {
mode: 'markdown', // default is "gfm"
context: 'github/linguist',
})
```