Skip to content

Commit

Permalink
refactor!: api only
Browse files Browse the repository at this point in the history
  • Loading branch information
phanen committed May 11, 2024
1 parent 12eac8d commit bc467bf
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 75 deletions.
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
[![CI](https://github.com/phanen/mder.nvim/actions/workflows/ci.yml/badge.svg)](https://github.com/phanen/mder.nvim/actions/workflows/ci.yml)
# mder.nvim

# mder.nvim
## Install
```lua
{ "phanen/mder.nvim", ft = "markdown", config = true },
```
> BREAKING CHANGES: this lib provide api only now
## Config
see `config.lua`
```lua
local default_opts = {
ft = { "markdown", "typst" },
line = "<c- >",
codeblock = "<c-e>",
listdn = "o",
listup = "O",
img_link = "<leader>zi",
raw_link = "<leader>zj",
}
{ "phanen/mder.nvim", ft = "markdown" }
```

## API
see `commands.lua`
8 changes: 4 additions & 4 deletions lua/mder/codeblock.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- surround codeblock with correct indent
local wrap_codeblock = function()
local M = {}

M.surround = function()
local vs, ve = vim.fn.getpos(".")[2], vim.fn.getpos("v")[2]
if vs > ve then
vs, ve = ve, vs
Expand All @@ -15,6 +17,4 @@ local wrap_codeblock = function()
vim.api.nvim_feedkeys("A", "n", false)
end

return {
wrap_codeblock = wrap_codeblock,
}
return M
8 changes: 0 additions & 8 deletions lua/mder/commands.lua

This file was deleted.

34 changes: 0 additions & 34 deletions lua/mder/config.lua

This file was deleted.

7 changes: 0 additions & 7 deletions lua/mder/init.lua

This file was deleted.

8 changes: 4 additions & 4 deletions lua/mder/utils.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
local M = {}

-- 0-index, exclusive, linewise
-- also "correct" in normal mode
local visual_region = function()
M.visual_region = function()
local vs, ve = vim.fn.line ".", vim.fn.line "v"
if vs > ve then
vs, ve = ve, vs
end
return vs - 1, ve
end

return {
visual_region = visual_region,
}
return M

0 comments on commit bc467bf

Please sign in to comment.