A cache for @remark-embedder/core
npm install @remark-embedder/cache---
[![Build Status][build-badge]][build]
[![Code Coverage][coverage-badge]][coverage]
[![version][version-badge]][package]
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
[![All Contributors][all-contributors-badge]](#contributors-)
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
You're using [@remark-embedder/core][@remark-embedder/core] and you want to
cache the results of your transformers long-term so you don't have to make
network requests for HTML every time.
This is a cache implementation specifically for
[@remark-embedder/core][@remark-embedder/core] that saves the results ofgetHTML for a transformer to disk (in node_modules/.cache by default).
- Installation
- Usage
- Inspiration
- Other Solutions
- Issues
- π Bugs
- π‘ Feature Requests
- Contributors β¨
- LICENSE
This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's dependencies:
``shell`
npm install @remark-embedder/cache
`ts
import Cache from '@remark-embedder/cache'
const cache = new Cache()
async function go() {
const result = await remark()
.use(remarkEmbedder, {
cache,
transformers: [
// transformers
],
})
.use(html)
.process(someMarkdown)
}
go().then(go).then(go).then(go)
// your transformers will only be called once even though we call process 4 times.
`
The default directory is pretty reasonable:
path.join(process.cwd(), 'node_modules/.cache/@remark-embedder/cache'), but ifCache
you want to change it, that's the first argument of the constructor:new Cache(directory)`.
- [Gatsby's built-in plugin cache][gatsby-plugin-cache-source]
I'm not aware of any, if you are please [make a pull request][prs] and add it
here!
_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._
Please file an issue for bugs, missing documentation, or unexpected behavior.
[See Bugs][bugs]
Please file an issue to suggest new features. Vote on feature requests by adding
a π. This helps maintainers prioritize what to work on.
[See Feature Requests][requests]
Thanks goes to these people ([emoji key][emojis]):
Kent C. Dodds π» π π β οΈ | MichaΓ«l De Boey π π» π§ | Andreas Houben π |
This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!
MIT
[npm]: https://www.npmjs.com
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/github/workflow/status/remark-embedder/cache/validate?logo=github&style=flat-square
[build]: https://github.com/remark-embedder/cache/actions?query=workflow%3Avalidate
[coverage-badge]: https://img.shields.io/codecov/c/github/remark-embedder/cache.svg?style=flat-square
[coverage]: https://codecov.io/github/remark-embedder/cache
[version-badge]: https://img.shields.io/npm/v/@remark-embedder/cache.svg?style=flat-square
[package]: https://www.npmjs.com/package/@remark-embedder/cache
[downloads-badge]: https://img.shields.io/npm/dm/@remark-embedder/cache.svg?style=flat-square
[npmtrends]: https://www.npmtrends.com/@remark-embedder/cache
[license-badge]: https://img.shields.io/npm/l/@remark-embedder/cache.svg?style=flat-square
[license]: https://github.com/remark-embedder/cache/blob/main/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: https://makeapullrequest.com
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/remark-embedder/cache/blob/main/CODE_OF_CONDUCT.md
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributors-badge]: https://img.shields.io/github/all-contributors/remark-embedder/cache?color=orange&style=flat-square
[bugs]: https://github.com/remark-embedder/cache/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Acreated-desc+label%3Abug
[requests]: https://github.com/remark-embedder/cache/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement
[good-first-issue]: https://github.com/remark-embedder/cache/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement+label%3A%22good+first+issue%22
[@remark-embedder/core]: https://github.com/remark-embedder/core
[gatsby-plugin-cache-source]: https://github.com/gatsbyjs/gatsby/blob/0a06a795c434312150f30048567b0e2cd797027e/packages/gatsby/src/utils/cache.ts