https://github.com/yutanagano/smark.nvim
Smart, Prettier-compatible Markdown auto-bullet list plugin for NeoVim
https://github.com/yutanagano/smark.nvim
bullet list lua markdown neovim nvim prettier vim
Last synced: 2 months ago
JSON representation
Smart, Prettier-compatible Markdown auto-bullet list plugin for NeoVim
- Host: GitHub
- URL: https://github.com/yutanagano/smark.nvim
- Owner: yutanagano
- License: mit
- Created: 2025-05-20T06:55:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-26T17:15:26.000Z (8 months ago)
- Last Synced: 2025-10-26T19:18:21.601Z (8 months ago)
- Topics: bullet, list, lua, markdown, neovim, nvim, prettier, vim
- Language: Lua
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 🧠🚅 smark.nvim



Smark is a [NeoVim][neovim] plugin that helps you write and manipulate markdown
lists. It has an opinionated design with the following principles:
1. **Correct**: only consider and always output valid Markdown lists that have
a sane structure (e.g. list block is a clean tree, no sudden jumps in
indentation level, correct numbering)
2. **Clean**: follow [Prettier's][prettier] style convention
3. **Smart**: Automatically infer as much as possible
## 📋 Features
| Feature | Demo |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Automatic generation of list markers with `` (insert mode) or `o` (normal mode) |  |
| Supports list indentation / nested lists |  |
| Indenting multiple items at once |  |
| Toggle between ordered and unordered list types |  |
| Support for task list items |  |
| Toggle between plain and task list items |  |
| Support for multi-line list items |  |
| Inference of indent level list type from context |  |
| Automatic updates to indentation rules as necessary |  |
| Clearnly turning list items into paragraphs |  |
| Manual triggering of list block formatting |  |
## ⚙️ Installation
With [lazy.nvim][lazy]:
```lua
return {
{
"yutanagano/smark.nvim",
ft = { "markdown", "text" },
--Below are the default settings for the available options. You can omit
--the opts table below and simply set config = true if you are happy with
--the default settings.
opts = {
--Keymapping settings for list action commands.
--Set to false to disable.
mappings = {
--Format the current list block to be clean / correct.
format_list = "lf",
--Switch between ordered / unordered list types.
toggle_ordered = "lo",
--Toggle the completion status of a task list item.
toggle_completion = "lx",
--Toggle between plain and task list items.
toggle_task = "lt",
},
--Following the starting line of a list item, only contiguous lines that
--start with at least one whitespace character can be considered as part of
--a multi-line list item.
multiline_requires_whitespace = false,
},
}
}
```
> [!IMPORTANT]
> The `ft = { "markdown", "text" }` setting ensures the plugin is lazily loaded
> only after NeoVim opens a markdown or plain text buffer. However, regardless
> of lazy loading, the plugin is only active when editing markdown or plain
> text documents.
## 💭 Why smark?
I take a lot of Markdown notes in [NeoVim][neovim]. I'm lazy, so 1. I don't
like to think about formatting, and 2. I don't want to have to write out lists
manually. For the first problem, I use [conform.nvim][conform] and
[prettierd][prettierd] to auto-format my Markdown documents at write-time. For
the second problem, I previously used the wonderful plugin
[bullets.vim][bullets]. I love it, but one thing annoyed me - it didn't play
well with [Prettier's][prettier] auto-formatting of lists, specifically the
list indentation levels. So, I wrote my own auto-bullet plugin that
auto-completes lists in a Prettier-compatible way, which became smark.
> [!NOTE]
> Prettier formats nested Markdown lists so that the child list marker aligns
> with the content of the parent list item, resulting in 2 spaces for unordered
> lists and enough spaces (usually 3 or more) for ordered lists.
>
> ```markdown
> - Foo:
> - Bar
>
> 1. Foo
> 1. Bar
> 2. Foo
> 3. Foo
> 4. Foo
> 5. Foo
> 6. Foo
> 7. Foo
> 8. Foo
> 9. Foo
> 10. Foo:
> 1. Bar
> ```
## 📢 Shout-outs
- A less opinionated alternative plugin: [Bullets.vim][bullets]
- Hyperlinking Markdown documents: [markdown-oxide][markdown-oxide], [marksman][marksman]
- Render Markdown within NeoVim: [render-markdown.nvim][render-markdown]
- This plugin is tested using [mini.test][mini]
[bullets]: https://github.com/bullets-vim/bullets.vim
[conform]: https://github.com/stevearc/conform.nvim
[lazy]: https://github.com/folke/lazy.nvim
[markdown-oxide]: https://github.com/Feel-ix-343/markdown-oxide
[marksman]: https://github.com/artempyanykh/marksman
[mini]: https://github.com/echasnovski/mini.nvim/blob/main/README.md
[neovim]: https://neovim.io/
[prettier]: https://prettier.io/
[prettierd]: https://github.com/fsouza/prettierd
[render-markdown]: https://github.com/MeanderingProgrammer/render-markdown.nvim