https://github.com/onurozuduru/himarkdown.nvim
A plugin to decorate markdown files
https://github.com/onurozuduru/himarkdown.nvim
neovim-plugin
Last synced: 8 months ago
JSON representation
A plugin to decorate markdown files
- Host: GitHub
- URL: https://github.com/onurozuduru/himarkdown.nvim
- Owner: onurozuduru
- License: mit
- Created: 2024-05-07T23:49:49.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-16T16:45:02.000Z (over 1 year ago)
- Last Synced: 2024-05-16T17:51:17.786Z (over 1 year ago)
- Topics: neovim-plugin
- Language: Lua
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# himarkdown.nvim
Simple markdown highlight additions on top of TreeSitter.
Himarkdown.nvim is a plugin to decorate headers, dash, code block and quote on markdown file.
It changes markings and adds highlights on buffer.
## Requirements
- [Neovim 0.9.5](https://github.com/neovim/neovim/releases/tag/v0.9.5) or higher.
- [nvim-treesitter/nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
- Be sure `markdown` and `markdown_inline` are installed:
```
:TSInstall markdown markdown_inline
```## Install
Call `setup` function.```lua
require('himarkdown').setup()
```OR with configuration (below is the default configuration):
```lua
require('himarkdown').setup({
query = [[
(atx_heading [
(atx_h1_marker)
(atx_h2_marker)
(atx_h3_marker)
(atx_h4_marker)
(atx_h5_marker)
(atx_h6_marker)
] @title)
(thematic_break) @dash
(fenced_code_block) @codeblock
(block_quote_marker) @quote
(block_quote (paragraph (inline (block_continuation) @quote)))
(block_quote (paragraph (block_continuation) @quote))
(block_quote (block_continuation) @quote)
]],
captures = {
title = {
highlight = { link = "ColorColumn" },
mark = "*",
},
dash = {
highlight = { link = "LineNr" },
mark = "-",
repeat_mark = vim.api.nvim_win_get_width(0),
},
codeblock = {
highlight = { link = "ColorColumn" },
},
quote = {
highlight = { link = "LineNr" },
mark = "|",
},
},
enabled = true,
})
```### Lazy
```lua
{
"onurozuduru/himarkdown.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
config = true
}
```#### Example with opts
```lua
{
"onurozuduru/himarkdown.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
opts = {
captures = {
title = { mark = "*" },
quote = { mark = "|" },
dash = { mark = "-" },
},
},
}
```#### Example keymap
```lua
{
"onurozuduru/himarkdown.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
lazy = false,
keys = {
{ "m", function() require("himarkdown").toggle() end, desc = "Toggle HiMarkdown" },
},
}
```## TODOs
- [x] Add documentation
- [x] Add install section to `README.md`
- [x] Add screenshot to `README.md`
- [x] Clean up code
- [x] Add version check for Neovim 0.9.5
- [ ] Add tests
- [ ] Add Github actions to run tests
- [ ] Add Github actions to auto format## Similar Projects
- [lukas-reineke/headlines.nvim](https://github.com/lukas-reineke/headlines.nvim): More complete plugin and supports other filetypes in addition to markdown.