|
1 | | -# pkg-placeholder |
| 1 | +# markdown-it-todo-lists |
2 | 2 |
|
3 | 3 | [![npm version][npm-version-src]][npm-version-href] |
4 | 4 | [![npm downloads][npm-downloads-src]][npm-downloads-href] |
5 | 5 | [![bundle][bundle-src]][bundle-href] |
6 | 6 | [![JSDocs][jsdocs-src]][jsdocs-href] |
7 | 7 | [![License][license-src]][license-href] |
8 | 8 |
|
9 | | -_description_ |
| 9 | +A markdown-it plugin to create todo lists. |
10 | 10 |
|
11 | | -> **Note**: |
12 | | -> Replace `pkg-placeholder`, `_description_` and `antfu` globally to use this template. |
| 11 | +- [ ] item 1 |
| 12 | +- [x] item 2 |
| 13 | +- [X] item 3 |
13 | 14 |
|
14 | | -## Sponsors |
| 15 | +```markdown |
| 16 | +- [ ] item 1 |
| 17 | +- [x] item 2 |
| 18 | +- [X] item 3 |
| 19 | +``` |
15 | 20 |
|
16 | | -<p align="center"> |
17 | | - <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg"> |
18 | | - <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/> |
19 | | - </a> |
20 | | -</p> |
| 21 | +## Usage |
| 22 | + |
| 23 | +```bash |
| 24 | +npm i markdown-it-todo-lists |
| 25 | +``` |
| 26 | + |
| 27 | +```js |
| 28 | +import MarkdownIt from 'markdown-it' |
| 29 | +import MarkdownItTodoLists from 'markdown-it-todo-lists' |
| 30 | + |
| 31 | +const md = MarkdownIt() |
| 32 | + |
| 33 | +md.use(MarkdownItTodoLists, /* Options */) |
| 34 | + |
| 35 | +const html = md.render(/* ... */) |
| 36 | +``` |
| 37 | + |
| 38 | +For the options available, please refer to [the jsdoc](./src/index.ts). |
| 39 | + |
| 40 | +## Functionality |
| 41 | + |
| 42 | +```markdown |
| 43 | +- [ ] item 1 |
| 44 | +- [x] item 2 |
| 45 | +``` |
| 46 | + |
| 47 | +Use `enabled = true` in options: |
| 48 | + |
| 49 | +```js |
| 50 | +md.use(MarkdownItTodoLists, { |
| 51 | + enabled: true |
| 52 | +}) |
| 53 | +``` |
| 54 | + |
| 55 | +to HTML: |
| 56 | + |
| 57 | +```html |
| 58 | +<ul class="todo-list-container"> |
| 59 | + <li class="todo-list-item"> |
| 60 | + <input class="todo-list-item-checkbox" type="checkbox" />item 1 |
| 61 | + </li> |
| 62 | + <li class="todo-list-item"> |
| 63 | + <input class="todo-list-item-checkbox" type="checkbox" checked />item 2 |
| 64 | + </li> |
| 65 | +</ul> |
| 66 | +``` |
| 67 | + |
| 68 | +Use `useLabel = true` in options: |
| 69 | + |
| 70 | +```js |
| 71 | +md.use(MarkdownItTodoLists, { |
| 72 | + useLabel: true |
| 73 | +}) |
| 74 | +``` |
| 75 | + |
| 76 | +to HTML: |
| 77 | + |
| 78 | +```html |
| 79 | +<ul class="todo-list-container"> |
| 80 | + <li class="todo-list-item"> |
| 81 | + <label> |
| 82 | + <input class="todo-list-item-checkbox" type="checkbox" disabled />item 1 |
| 83 | + </label> |
| 84 | + </li> |
| 85 | + <li class="todo-list-item"> |
| 86 | + <label> |
| 87 | + <input class="todo-list-item-checkbox" type="checkbox" checked disabled />item 2 |
| 88 | + </label> |
| 89 | + </li> |
| 90 | +</ul> |
| 91 | +``` |
21 | 92 |
|
22 | 93 | ## License |
23 | 94 |
|
24 | | -[MIT](./LICENSE) License © 2024-PRESENT [Anthony Fu](https://github.com/antfu) |
| 95 | +[MIT](./LICENSE) License © 2024-PRESENT [Anthony Fu](https://github.com/skyline523) |
25 | 96 |
|
26 | 97 | <!-- Badges --> |
27 | 98 |
|
28 | | -[npm-version-src]: https://img.shields.io/npm/v/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669 |
29 | | -[npm-version-href]: https://npmjs.com/package/pkg-placeholder |
30 | | -[npm-downloads-src]: https://img.shields.io/npm/dm/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669 |
31 | | -[npm-downloads-href]: https://npmjs.com/package/pkg-placeholder |
32 | | -[bundle-src]: https://img.shields.io/bundlephobia/minzip/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669&label=minzip |
33 | | -[bundle-href]: https://bundlephobia.com/result?p=pkg-placeholder |
34 | | -[license-src]: https://img.shields.io/github/license/antfu/pkg-placeholder.svg?style=flat&colorA=080f12&colorB=1fa669 |
35 | | -[license-href]: https://github.com/antfu/pkg-placeholder/blob/main/LICENSE |
| 99 | +[npm-version-src]: https://img.shields.io/npm/v/markdown-it-todo-lists?style=flat&colorA=080f12&colorB=1fa669 |
| 100 | +[npm-version-href]: https://npmjs.com/package/markdown-it-todo-lists |
| 101 | +[npm-downloads-src]: https://img.shields.io/npm/dm/markdown-it-todo-lists?style=flat&colorA=080f12&colorB=1fa669 |
| 102 | +[npm-downloads-href]: https://npmjs.com/package/markdown-it-todo-lists |
| 103 | +[bundle-src]: https://img.shields.io/bundlephobia/minzip/markdown-it-todo-lists?style=flat&colorA=080f12&colorB=1fa669&label=minzip |
| 104 | +[bundle-href]: https://bundlephobia.com/result?p=markdown-it-todo-lists |
| 105 | +[license-src]: https://img.shields.io/github/license/antfu/markdown-it-todo-lists.svg?style=flat&colorA=080f12&colorB=1fa669 |
| 106 | +[license-href]: https://github.com/antfu/markdown-it-todo-lists/blob/main/LICENSE |
36 | 107 | [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669 |
37 | | -[jsdocs-href]: https://www.jsdocs.io/package/pkg-placeholder |
| 108 | +[jsdocs-href]: https://www.jsdocs.io/package/markdown-it-todo-lists |
0 commit comments