# happy-mark

> markdown to js ast parser

Latest version **1.9.0** (published 2026-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install happy-mark
pnpm add happy-mark
yarn add happy-mark
bun add happy-mark
```

Provides the command `happy-mark`.

## Health

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

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.9.0 |
| Published | 2026-09-05 |
| First published | 2026-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 8 |
| Unpacked size | 55 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | store, variable, functional |

## Links

- npm: https://www.npmjs.com/package/happy-mark
- Repository: https://github.com/coderaiser/happy-mark
- Issues: https://github.com/coderaiser/happy-mark/issues
- npm.io page: https://npm.io/package/happy-mark

## Dependencies (8)

- [redstd](https://npm.io/package/redstd.md) ^1.0.2
- [unified](https://npm.io/package/unified.md) ^11.0.5
- [remark-gfm](https://npm.io/package/remark-gfm.md) ^4.0.1
- [remark-parse](https://npm.io/package/remark-parse.md) ^11.0.0
- [@putout/babel](https://npm.io/package/@putout/babel.md) ^5.7.3
- [@putout/printer](https://npm.io/package/@putout/printer.md) ^18.17.0
- [remark-frontmatter](https://npm.io/package/remark-frontmatter.md) ^5.0.0
- [@putout/operator-json](https://npm.io/package/@putout/operator-json.md) ^3.4.0

## Recent versions

- 1.9.0 (latest) — 2026-09-05
- 1.8.0 — 2026-09-05
- 1.7.1 — 2026-07-30
- 1.7.0 — 2026-06-21
- 1.6.0 — 2026-06-21
- 1.5.0 — 2026-06-19
- 1.4.0 — 2026-06-18
- 1.3.0 — 2026-06-17
- 1.2.0 — 2026-06-14
- 1.1.2 — 2026-06-14
- 1.1.1 — 2026-06-14
- 1.1.0 — 2026-06-14
- 1.0.12 — 2026-06-14
- 1.0.11 — 2026-06-13
- 1.0.10 — 2026-06-13
- … 10 more at https://npm.io/package/happy-mark/versions

## README

# Happy Mark [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]

[NPMURL]: https://npmjs.org/package/happy-mark "npm"
[NPMIMGURL]: https://img.shields.io/npm/v/happy-mark.svg?style=flat
[BuildStatusURL]: https://github.com/coderaiser/happy-mark/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/coderaiser/happy-mark/workflows/Node%20CI/badge.svg
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"

<img width="770" height="554" alt="image" src="https://github.com/user-attachments/assets/b1f7a29a-52a1-42b0-893b-51c17f48f192" />

Markdown to JS AST parser.

## Install

```
npm i happy-mark --save
```

## How to use?

### Binary

```sh
cat README.md | happy-mark
```

For full loop use (format detected automatically):

```sh
cat README.md | happy-mark | happy-mark
```

### Reference

Happy Mark converts Markdown to JavaScript this way:

| Markdown       | Becomes                          |
|----------------|----------------------------------|
| `# Heading`    | `heading(1, 'Heading')`          |
| `Some text`    | `paragraph('Some text')`         |
| `**bold**`     | `paragraph(bold('bold'))`        |
| `- one\n- two` | `ul(li('one'), li('two'))`       |
| `> quote`      | `blockquote(paragraph('quote'))` |
| `![alt](url)`  | `paragraph(image('alt', 'url'))` |
| `[text](url)`  | `link('text', 'url')`            |

### API

```js
import {
    convertMarkdownToJs,
    convertJsToMarkdown,
} from 'happy-mark';
import {montag} from 'montag';

const source = montag`
    # hello
    
    Hello world
    
    \`\`\`js
    const a = 3;
    \`\`\`
`;

const js = convertMarkdownToJs(source);

// returns
`
[
    header(1, 'hello'),
    paragraph('Hello world'),
    codeblock('js', 'const a = 3;'),
];
`;

convertJsToMarkdown(js);
// returns
`
    # hello
    
    Hello world
    
    \`\`\`js
    const a = 3;
    \`\`\`
`;
```

## License

MIT

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