# md2cwm

> markdown to Confluence Wiki Markup

Latest version **1.0.4** (published 2022-04-04) · MIT license · 0 weekly downloads

## Install

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

Provides the commands `md2c`, `md2cwm`.

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-04-04 |
| First published | 2022-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 531.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | SonOfMagic |
| Maintainers | icebreaker |
| Keywords | Confluence, Wiki, Markup, markdown, md |

## Links

- npm: https://www.npmjs.com/package/md2cwm
- Repository: https://github.com/sonofmagic/md2cwm
- Homepage: https://github.com/sonofmagic/md2cwm#readme
- Issues: https://github.com/sonofmagic/md2cwm/issues
- npm.io page: https://npm.io/package/md2cwm

## Dependencies (2)

- [marked](https://npm.io/package/marked.md) ^4.0.12
- [@types/marked](https://npm.io/package/@types/marked.md) ^4.0.3

## 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.4 (latest) — 2022-04-04
- 1.0.3 — 2022-04-02
- 1.0.2 — 2022-04-01
- 1.0.1 — 2022-04-01
- 1.0.0 — 2022-04-01

## README

# md2cwm

> This is a fork form [Shogobg/markdown2confluence](https://github.com/Shogobg/markdown2confluence), Thanks for `Shogobg` to provide such goof util and i wanna do some refactors with markdown ast utils.

This tool converts [Markdown] to [Confluence Wiki Markup].

## Installation

```sh
npm i -g md2cwm
```

```bash
npm i --save md2cwm
```

## Command-Line Use

Read in Markdown files and allow to use glob

```bash
md2c *.md <path/to/docs>
// md2cwm the same
```

## As library dependency

Now you write some JavaScript to load Markdown content and convert.

```javascript
const md2cwm = require('md2cwm');
const markdown = fs.readFileSync('README.md');
const confluence = md2cwm(markdown);
console.log(confluence);
```

This uses the wonderful [marked](https://www.npmjs.com/package/marked) library to parse and reformat the Markdown text.

## Custom options

Since this tool uses [marked](https://www.npmjs.com/package/marked), there is a pre-defined renderer which we pass to [marked](https://www.npmjs.com/package/marked).
If you want to replace any of the predefined functions or the renderer as a whole, you can do so by passing an options object to the tool.

```javascript
md2cwm = require('md2cwm');
markdown = fs.readFileSync('README.md');
confluence = md2cwm(markdown, {
  renderer: {
    link: href => {
      return `http://example.com/${href}`;
    },
  },
});
console.log(confluence);
```

Additionally, the options objects takes custom arguments for the confluence code block options.

```javascript
md2cwm = require('md2cwm');
markdown = fs.readFileSync('README.md');
confluence = md2cwm(markdown, {
  renderer: {
    link: href => {
      return `http://example.com/${href}`;
    },
  },
  codeBlock: {
    // Adds support for new language
    languageMap: {
      leet: '1337',
    },
    // Shows the supported options and their default values
    options: {
      title: 'none',
      language: 'none',
      borderStyle: 'solid',
      theme: 'RDark', // dark is good
      linenumbers: true,
      collapse: true,
    },
  },
});
console.log(confluence);
```

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