@suin/mdast-character-count
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@suin/mdast-character-count

[mdast] utility to count characters.

Installation

yarn add @suin/mdast-character-count
# or
npm install @suin/mdast-character-count

Usage

import { countCharacter } from "@suin/mdast-character-count";

const text = markdown`
# 12345

1234567890

- 12345
- 12345

~~~
12345
~~~
`;
const tree = mdastUtilFromMarkdown(text);
const { textCharacters, codeCharacters } = countCharacter(tree);

console.log(textCharacters); //=> 25
console.log(codeCharacters); //=> 5

More examples, see example.test.ts.

API Reference

https://suin.github.io/mdast-character-count/

Package Sidebar

Install

npm i @suin/mdast-character-count

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

8.57 kB

Total Files

6

Last publish

Collaborators

  • suin