# markdown-it-indent

> Add paragraph indentation and line blocks to markdown-it

Latest version **1.0.0** (published 2023-08-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-indent
pnpm add markdown-it-indent
yarn add markdown-it-indent
bun add markdown-it-indent
```

## 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.0.0 |
| Published | 2023-08-16 |
| First published | 2023-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | geezmolycos |
| Keywords | markdown-it-plugin, markdown-it, markdown |

## Links

- npm: https://www.npmjs.com/package/markdown-it-indent
- Repository: https://github.com/geezmolycos/markdown-it-indent
- Homepage: https://github.com/geezmolycos/markdown-it-indent#readme
- Issues: https://github.com/geezmolycos/markdown-it-indent/issues
- npm.io page: https://npm.io/package/markdown-it-indent

## 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.0 (latest) — 2023-08-16

## README

# markdown-it-indent

This is a plugin for markdown-it that adds syntaxes for controlling paragraph indentation.

## Paragraph indentation

Write several `^` separated by a single space before the first line of a paragraph to indent the paragraph. Each `^` will indent by 1em

Input:

```
Paragraph indentation

^ ^
2em whole paragraph indentation.
```

Output:

```
Paragraph indentation

    2em whole paragraph
    indentation
```

## Line indentation

Similar to paragraph indentation, carets before the content of paragraph will indent only the first line or the following lines depending on the line they are written before.

Input:
```
First line indentation:

^ ^ 2em first line indentation
```

Output:
```
First line indentation:

    2em first line
indentation
```

Input (written before the second line):
```
Hanging indentation:

The first line is not indented,
^ ^ but the following lines are 
indented by 2em.
```

Output:
```
Hanging indentation:

The first line is not
    indented, but the
    following lines are 
    indented by 2em.
```

## Line block

Borrowed from [pandoc's extension](https://pandoc.org/MANUAL.html#line-blocks). Wrapping line beginning with space is currently not implemented.

Input:
```
| The limerick packs laughs anatomical
| In space that is quite economical.
|    But the good ones I've seen
|    So seldom are clean
| And the clean ones so seldom are comical
```

Output:
```
The limerick packs laughs anatomical
In space that is quite economical.
  But the good ones I've seen
  So seldom are clean
And the clean ones so seldom are comical
```

## Usage

When a paragraph has any type of indentation, the class `indented` is appended. The specific type and amount will be appended as css variables.

- `--head-indent`: whole paragraph indentation
- `--initial-indent`: first line indetation
- `--following-indent`: following lines indentation

You must use a custom css rule to make it render properly. Like below:

```
.indented {
    padding-left: calc(var(--head-indent, 0em) + var(--following-indent, 0em));
    text-indent: calc(var(--initial-indent, 0em) - var(--following-indent, 0em));
}
```

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