Skip to content

onurozuduru/himarkdown.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

himarkdown

Requirements

:TSInstall markdown markdown_inline

Install

Call setup function.

require('himarkdown').setup()

OR with configuration (below is the default configuration):

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

{
  "onurozuduru/himarkdown.nvim",
  dependencies = "nvim-treesitter/nvim-treesitter",
  config = true
}

Example with opts

{
  "onurozuduru/himarkdown.nvim",
  dependencies = "nvim-treesitter/nvim-treesitter",
  opts = {
    captures = {
      title = { mark = "*" },
      quote = { mark = "|" },
      dash = { mark = "-" },
    },
  },
}

Example keymap

{
  "onurozuduru/himarkdown.nvim",
  dependencies = "nvim-treesitter/nvim-treesitter",
  lazy = false,
  keys = {
    { "<Leader>m", function() require("himarkdown").toggle() end, desc = "Toggle HiMarkdown" },
  },
}

TODOs

  • Add documentation
  • Add install section to README.md
  • Add screenshot to README.md
  • Clean up code
  • Add version check for Neovim 0.9.5
  • Add tests
  • Add Github actions to run tests
  • Add Github actions to auto format

Similar Projects

About

A plugin to decorate markdown files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published