# marked-admonition-extension

> an admonition extension for [marked](https://github.com/markedjs/marked)

Latest version **0.0.4** (published 2023-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install marked-admonition-extension
pnpm add marked-admonition-extension
yarn add marked-admonition-extension
bun add marked-admonition-extension
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-05-26 |
| First published | 2022-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 31.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | xiefucai |
| Maintainers | xiefucai |
| Keywords | marked, marked extension, markdown, markdown plugin |

## Links

- npm: https://www.npmjs.com/package/marked-admonition-extension
- Repository: https://github.com/xiefucai/marked-admonition-extension
- Issues: https://github.com/xiefucai/marked-admonition-extension/issues
- npm.io page: https://npm.io/package/marked-admonition-extension

## Dependencies (2)

- [@types/node](https://npm.io/package/@types/node.md) ^18.7.18
- [@types/marked](https://npm.io/package/@types/marked.md) ^4.0.7

## 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.0.4 (latest) — 2023-05-26
- 0.0.3 — 2023-05-26
- 0.0.2 — 2022-10-26
- 0.0.1 — 2022-09-18

## README

# marked-admonition-extension
an admonition extension for [marked](https://github.com/markedjs/marked), both support `ESM` and `CJS`.

## Usage
you can use `abstract`、`attention`、`bug`、`caution`、`danger`、`error`、`example`、`failure`、`hint`、`info`、`note`、`question`、`quote`、`success`、`tip`、`warning` as their theme;

the below code can be used in node.js, base CommonJs.
``` js
const { marked } = require('marked');
const admonition = require('marked-admonition-extension');

// custom tag name and class name (note: only version greater than v0.0.2 support)
// admonition.setConfig({ nodeName: 'details', className: 'details', title: { nodeName: 'summary' } });

// import the css file
require('marked-admonition-extension/dist/index.css');

marked.use(admonition.default);

const content = marked.parse(`!!! info Publish ESM and CJS in a single package
In the past decade, due to the lack of a standard module system of \`JavaScript\`, **CommonJS** (a.k.a the \`require('xxx')\` and \`module.exports\` syntax) has been the way how Node.js and NPM packages work. Until 2015, when ECMAScript modules finally show up as the standard solution, the community start migrating to native ESM gradually.
!!!`);

console.log(content);
```
it will output
``` html
<div class="admonition admonition-info">
    <p class="admonition-title">Publish ESM and CJS in a single package</p>
    <p>In the past decade, due to the lack of a standard module system of <code>JavaScript</code>, <strong>CommonJS</strong> (a.k.a the <code>require(&#39;xxx&#39;)</code> and <code>module.exports</code> syntax) has been the way how Node.js and NPM packages work. Until 2015, when ECMAScript modules finally show up as the standard solution, the community start migrating to native ESM gradually.</p>

    </div>
```

## Demo

Checkout the [demo page](https://stackblitz.com/edit/typescript-cbre5j?file=index.ts) to see marked in action ⛹️.
Or you can edit and view preview result in [markdown editor](https://xiefucai.gitee.io/article/**).

## License

Copyright (c) 2011-2022, Christopher Jeffrey. (MIT License)

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