# commenting

> Wrap content in a comment that is valid for a given file type.

Latest version **1.1.0** (published 2019-06-03) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-06-03 |
| First published | 2015-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden |
| Keywords | comment, comments, commenting |

## Links

- npm: https://www.npmjs.com/package/commenting
- Repository: https://github.com/3rd-Eden/commenting
- Homepage: https://github.com/3rd-Eden/commenting#readme
- Issues: https://github.com/3rd-Eden/commenting/issues
- npm.io page: https://npm.io/package/commenting

## Recent versions

- 1.1.0 (latest) — 2019-06-03
- 1.0.5 — 2018-03-04
- 1.0.4 — 2017-07-03
- 1.0.3 — 2017-02-20
- 1.0.2 — 2015-08-21
- 1.0.1 — 2015-08-14
- 1.0.0 — 2015-08-07

## README

# commenting

Commenting is a small module that allows you to wrap text in to a comment format
which is suitable for the supplied extension. This can be useful if you do not
want to trigger content errors for 404 routes on static assets so you can put
your reason inside a comment instead of returning HTML. But it can also be used
a development tool to inject build information in to your files for example.

## Installation

Module is released in the public npm registry and can be installed by running:

```
npm install --save commenting
```

## Usage

The module exposes a single function as API. This function accepts the text as
string or array as first argument and an options object as last argument. The
following options are supported:

- extension: The file extension, which is used to figure out which comment style
  should be used.
- style: Override default extension mapping and provide a comment style your
  self (should be an object with start, body and end properties which contains
  the comment styles).

```js
'use strict';

var commenting = require('commenting')
  , comment;

comment = commenting('hello world', { extension: '.js' });

/**
 * hello world
 */

comment = commenting(['hello', 'world'], { extension: '.jade' });

//
// hello
// world
//
```

The following extensions are supported:

- html, html: Uses HTML comments.
- js, css, less, sass: Uses `/**/` style comments
- coffee: Uses `###` style comments.
- jade: Uses `//` style comments.

Empty files or extension option with `''` as value is automatically mapped to a
hash `#` based comment style. This is because things like `.npmignore` or
`.gitignore` don't have have extensions that we can track.

## License

MIT

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