# roommirror

> Syntax highlight code blocks that is generated from Markdown with CodeMirror.

Latest version **0.0.9** (published 2015-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install roommirror
pnpm add roommirror
yarn add roommirror
bun add roommirror
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2015-04-18 |
| First published | 2015-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Keita Okamoto |
| Maintainers | all-user |
| Keywords | syntax highlight, codemirror, Markdown, browserify |

## Links

- npm: https://www.npmjs.com/package/roommirror
- Repository: https://github.com/all-user/RoomMirror
- Issues: https://github.com/all-user/RoomMirror/issues
- npm.io page: https://npm.io/package/roommirror

## Dependencies (4)

- [extend](https://npm.io/package/extend.md) ^2.0.0
- [append-css](https://npm.io/package/append-css.md) ^0.1.2
- [codemirror](https://npm.io/package/codemirror.md) ^5.0.0
- [evaluable-tag](https://npm.io/package/evaluable-tag.md) 0.0.5

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 0.0.9 (latest) — 2015-04-18
- 0.0.8 — 2015-04-18
- 0.0.7 — 2015-04-18
- 0.0.6 — 2015-04-17
- 0.0.5 — 2015-04-13
- 0.0.4 — 2015-04-12
- 0.0.3 — 2015-04-12
- 0.0.2 — 2015-04-11

## README

# RoomMirror
Syntax highlight code blocks generated from Markdown with CodeMirror.

## doc in japanese

[RoomMirror Doc: 日本語ドキュメント](http://all-user.github.io/roommirror/docs)

## install
```bash
npm install roommirror
```

## usage

### common settings
path to `codemirror` is `"roommirror_root/node_modules/codemirror"`
```html
<link rel="stylesheet" href="codemirror/lib/codemirror.css">
```
and theme files...
```html
<link rel="stylesheet" href="codemirror/theme/base16-dark.css">
<link rel="stylesheet" href="codemirror/theme/solarized.css">
<link rel="stylesheet" href="codemirror/theme/monokai.css">
```

### in browser
```html
<script src="browser/roommirror.js"></script>
```

or __exclude CodeMirror__...
```html
<script src="path/to/codemirror.js"></script>
<script src="browser/rm_without_cm.js"></script>
```

and __mode files...__
```html
<script src="codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="codemirror/mode/javascript/javascript.js"></script>
<script src="codemirror/mode/css/css.js"></script>
```

### in browserify
```javascript
var RoomMirror = require('roommirror');

// and mode files...
require('codemirror/mode/htmlmixed/htmlmixed.js');
require('codemirror/mode/javascript/javascript.js');
require('codemirror/mode/css/css.js');
```

## RoomMirror(qs) -> [CodeMirror]

- parameter<br>
  __qs__: css selector of elements you want syntax highlighting.
- return<br>
  __[CodeMirror]__: array of codemirror instances that highlighted code blocks.

## RoomMirror.byAnnotation(qs) -> [CodeMirror]

- parameter<br>
  __qs__: css selector of previous elements you want syntax highlighting.
```html
<p class="rm-a" data-eval="{ mode: 'javascript' }"></p>
<div>var test = 'test';</div>
```
- return<br>
  __[CodeMirror]__: array of codemirror instances that highlighted code blocks.

## example for markdown
in markdown...
```markdown
<p class="rm-a" data-eval="{ mode: 'javascript', lineNumbers: true }"></p>

    var test = 'test';
    var add = function(a, b) {
      return a + b;
    };

    [0, 1, 2, 3, 4].reduce(add, 0); // 10

```

generate to html...

```html
<p class="rm-a" data-eval="{ mode: 'javascript', lineNumbers: true }"></p>
<pre><code>var test = 'test';
var add = function(a, b) {
  return a + b;
};

[0, 1, 2, 3, 4].reduce(add, 0); // 10</code></pre>
```

syntax highlighting

```javascript
var roommirrors = RoomMirror.byAnnotation('.rm-a');
```

##demo

in myblog: [メモを揉め](http://memowomome.hatenablog.com/entry/2015/04/18/145610)

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