# @mryhryki/markdown-preview

> Markdown realtime preview on browser with your favorite editor

Latest version **0.8.25** (published 2026-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mryhryki/markdown-preview
pnpm add @mryhryki/markdown-preview
yarn add @mryhryki/markdown-preview
bun add @mryhryki/markdown-preview
```

Provides the command `markdown-preview`.

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 0.8.25 |
| Published | 2026-08-02 |
| First published | 2021-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=20.0.0 |
| Dependencies | 6 |
| Unpacked size | 9.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 14 |
| Author | mryhryki |
| Maintainers | mryhryki |
| Keywords | markdown, preview |

## Links

- npm: https://www.npmjs.com/package/@mryhryki/markdown-preview
- Repository: https://github.com/mryhryki/markdown-preview
- Homepage: https://github.com/mryhryki/markdown-preview#readme
- Issues: https://github.com/mryhryki/markdown-preview/issues
- npm.io page: https://npm.io/package/@mryhryki/markdown-preview

## Dependencies (6)

- [ws](https://npm.io/package/ws.md) 8.21.1
- [log4js](https://npm.io/package/log4js.md) 6.9.1
- [opener](https://npm.io/package/opener.md) 1.5.2
- [express](https://npm.io/package/express.md) 5.2.1
- [express-ws](https://npm.io/package/express-ws.md) 5.0.2
- [serve-index](https://npm.io/package/serve-index.md) 1.9.2

## 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

- 0.8.25 (latest) — 2026-08-02
- 0.8.24 — 2026-07-21
- 0.8.23 — 2026-05-11
- 0.8.22 — 2026-04-18
- 0.8.21 — 2026-04-01
- 0.8.20 — 2026-03-28
- 0.8.19 — 2026-02-14
- 0.8.18 — 2025-09-27
- 0.8.17 — 2025-07-29
- 0.8.16 — 2025-07-24
- 0.8.15 — 2025-07-14
- 0.8.14 — 2025-06-18
- 0.8.13 — 2025-05-20
- 0.8.12 — 2025-05-07
- 0.8.11 — 2025-04-22
- … 34 more at https://npm.io/package/@mryhryki/markdown-preview/versions

## README

# markdown-preview

Markdown realtime preview on browser with your favorite editor.

## Concept

- Execute immediately with [npx](#npx).
- Offline support if [installed](#npm--yarn-install).
- [You can create your own template easily.](#2-how-to-create-a-template-file)

## Demo

<video 
  style="max-width: 100%; object-fit: contain;"
  src="https://github.com/mryhryki/markdown-preview/assets/12733897/8c7afd39-4d02-4e9a-b84f-863f11630e6b"
  controls></video>

## Usage

### npx

```shell
$ npx @mryhryki/markdown-preview
Version        : v0.6.0
Root Directory : /current/dir
Default File   : README.md
Extensions     : md, markdown
Template File  : /path/to/template/default.html
Preview URL    : http://localhost:34567
```

### npm / yarn (install)

```shell
$ npm install -g @mryhryki/markdown-preview
# or
$ yarn install -g @mryhryki/markdown-preview

$ markdown-preview
Version        : v0.6.0
Root Directory : /current/dir
Default File   : README.md
Extensions     : md, markdown
Template File  : /path/to/template/default-dark.html
Preview URL    : http://localhost:34567
```

## Parameter

| short | long         | environment variable        | parameter                                             | required | default     |
|-------|--------------|-----------------------------|-------------------------------------------------------|----------|-------------|
| -f    | --file       | MARKDOWN_PREVIEW_FILE       | ***relative*** file path                              | no       | README.md   |
| -e    | --extensions | MARKDOWN_PREVIEW_EXTENSIONS | comma separated extensions                            | no       | md,markdown |
| -t    | --template   | MARKDOWN_PREVIEW_TEMPLATE   | defined template name (*1) or template file path (*2) | no       | default     |
| -p    | --port       | MARKDOWN_PREVIEW_PORT       | port number                                           | no       | 34567       |
|       | --log-level  | MARKDOWN_PREVIEW_LOG_LEVEL  | trace, debug, info<br>warn, error, fatal              | no       | info        |
|       | --no-opener  | MARKDOWN_PREVIEW_NO_OPENER  | true (only env var)                                   | no       |             |
| -v    | --version    |                             |                                                       | no       |             |
| -h    | --help       |                             |                                                       | no       |             |

### *1: Defined Template Names

- `default`

### *2: How to create a template file

You just need to load `/markdown-preview-websocket.js` and register a callback to `connectMarkdownPreview`.

A simple example code is below:

```html
<!doctype html>
<html>
  <head>
    <title>Minimum Template Sample</title>
  </head>
  <body>
    <pre id="raw-markdown"></pre>
    <script type="module">
      import { connectMarkdownPreview } from "/markdown-preview-websocket.js";
      connectMarkdownPreview(({ markdown }) => {
        document.getElementById('raw-markdown').innerHTML =
          markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
      });
    </script>
  </body>
</html>
```

## Development

```shell
$ npm install

# Build and Run
$ npm start

# Test
$ npm test
$ npm run test:watch

# Type check
$ npm run type
$ npm run type:watch

# Check code format
$ npm run lint

# Formatter
$ npm run fmt
```

## Release

Run [release](https://github.com/mryhryki/markdown-preview/actions/workflows/release.yaml) workflow.

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