# md-mirror

> Renders remote markup files in your service

Latest version **1.0.0** (published 2020-03-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install md-mirror
pnpm add md-mirror
yarn add md-mirror
bun add md-mirror
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-13 |
| First published | 2020-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | 121593 |
| Maintainers | -121593 |
| Keywords | markdown, mirror, git, remote |

## Links

- npm: https://www.npmjs.com/package/md-mirror
- Repository: https://gitlab.com/121593/md-mirror
- Issues: https://gitlab.com/121593/md-mirror/issues
- npm.io page: https://npm.io/package/md-mirror

## Dependencies (3)

- [markdown-it](https://npm.io/package/markdown-it.md) ^10.0.0
- [is-relative-url](https://npm.io/package/is-relative-url.md) ~3.0.0
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.10.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-03-13

## README

# md-mirror

Fetch and mirror remote md files


Primary goal is to mirror files on GitHub but it should works with other services

[![Build status](https://gitlab.com/121593/md-mirror/badges/master/pipeline.svg)](https://gitlab.com/121593/md-mirror/pipelines)
[![npm version](https://badge.fury.io/js/md-mirror.svg)](https://badge.fury.io/js/md-mirror)
[![Dependencies](https://david-dm.org/121593/md-mirror.svg)](https://david-dm.org/121593/md-mirror.svg)
[![ISC license](http://img.shields.io/badge/license-ISC-brightgreen.svg)](http://opensource.org/licenses/ISC)

## Installation
`npm i md-mirror`

## Usage
Methods can be used statically, or through an instance holding options. One of them return html content, this other call the supplied render method with that html content

### Statically
```ecmascript 6
// Logging html from a remote md file
const MdMirror = require('md-mirror')

MdMirror.html('/Meshtastic-esp32/master/README.md', {
  baseLocalUrl: '',
  baseRemoteUrl: 'https://raw.githubusercontent.com/meshtastic',
}).then(console.log)
```

### With an instance
```ecmascript 6
// Here we are rendering html from https://raw.githubusercontent.com/username repositories at the website root
// local url in the form : /reponame/branchname/whatever
const MdMirror = require('md-mirror')

app.get('/*', (req, res) => {
  const mm = new MdMirror({
    baseLocalUrl: '',
    baseRemoteUrl: 'https://raw.githubusercontent.com/username',
    viewManager: content => res.render('someview', { content })
  })

  return mm.render(req.url)
})
```
### Caching
Caching have not been tried yet.
@todo


## Example
An example application is included. Run it with : 

`npm run dev` 

and open your browser at [localhost:8080](http://localhost:8080)

## Contributing
Issue reports, pull requests, suggestions and comments are very welcome, don't hesitate !

Commits with [commitizen](https://github.com/commitizen/cz-cli). Style : [standard](https://standardjs.com/)

## License

[ISC](https://choosealicense.com/licenses/isc/)

Copyright (c) 2020, [121593](https://github.com/121593)

---
_Source: https://npm.io/package/md-mirror · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
