Skip to content

lukasschwab/knapping.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knapping.nvim

Extra Markdown highlighting for Neovim, loosely based on the checkbox styling and palette from the Obsidian Things theme.

Current scope:

  • colors the whole checkbox token, including brackets, with a Things-inspired palette
  • conceals checkbox tokens to symbols when a Nerd Font is available
  • highlights Obsidian-style callout headers and colors the > delimiters for the whole callout block
Screenshot of nvim showing ./test.md wiht knapping.nvim enabled

Supported checkboxes

- [ ] to-do
- [/] incomplete
- [x] done
- [-] canceled
- [>] forwarded
- [<] scheduling
- [?] question
- [!] important
- [*] star
- ["] quote
- [l] location
- [b] bookmark
- [i] information
- [S] savings
- [I] idea
- [p] pros
- [c] cons
- [f] fire
- [k] key
- [w] win
- [u] up
- [d] down
- [D] draft pull request
- [P] open pull request
- [M] merged pull request

Nested checkboxes are supported in indented lists and inside blockquotes because knapping matches the checkbox token after stripping Markdown list and blockquote prefixes.

Supported callouts

Knapping highlights Obsidian callouts written as blockquotes with a [!TYPE] header:

> [!NOTE]
> A basic callout.

> [!TIP] Custom title
> A callout with a custom title.

> [!WARNING]
> Outer callout
> > [!QUESTION]
> > Nested callout

Supported aliases include:

  • note
  • abstract, summary, tldr
  • info
  • todo
  • tip, hint
  • important
  • success, check, done
  • question, help, faq
  • warning, caution, attention
  • failure, fail, missing
  • danger, error
  • bug
  • example
  • quote, cite

GitHub alerts are supported as a documented subset:

  • NOTE
  • TIP
  • IMPORTANT
  • WARNING
  • CAUTION

Knapping supports nested callouts in source buffers by tracking callouts by quote depth and coloring each active > delimiter separately.

Installation

lazy.nvim

{
  "YOUR_GITHUB_USER/knapping.nvim",
  ft = "markdown",
  opts = {
    use_nerd_font = true,   -- or false!
  },
}

Plain runtimepath

vim.opt.rtp:append("~/Programming/knapping.nvim")
require("knapping").setup({
  use_nerd_font = true,     -- or false!
})

Configuration

Default configuration:

require("knapping").setup({
  filetypes = { "markdown" },
  use_nerd_font = false,
})

Notes:

  • use_nerd_font = false is the default; set it to true explicitly when you know your terminal or GUI font supports the glyphs you want
  • Nerd Font symbols are drawn as overlays, so knapping no longer needs to change window conceallevel
  • palette and symbols are fully overridable if you want different colors or glyphs

Example override:

require("knapping").setup({
  use_nerd_font = true,
  palette = {
    dark = {
      accent = "#7aa2f7",
      muted = "#6b7280",
    },
  },
  symbols = {
    incomplete = "",
    draft_pr = "",
  },
})

Commands

  • :KnappingRefresh
  • :KnappingEnable
  • :KnappingDisable

About

Bits of Obsidian, obsidian-things Markdown in nvim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors