Skip to content

Commit

Permalink
docs(usage): fold api section (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 authored Mar 8, 2024
1 parent 090a166 commit 944a4b8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
shell: bash
run: |
luarocks install vusted
vusted --shuffle ./spec
vusted ./spec
code_coverage:
name: Code Coverage
needs:
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ There're several arguments:
>
> Highly recommend reading [Customize Urls](#customize-urls) before this section, which helps understanding the router design of this plugin.
<details>
<summary><i>Click here to see lua api</i></summary>
<br/>

You can also use the `link` API to generate git permlink:

```lua
Expand All @@ -148,7 +152,7 @@ You can also use the `link` API to generate git permlink:
require("gitlinker").link(opts)
```

#### Parameters:
**Parameters:**

- `opts`: (Optional) lua table that contains below fields:

Expand Down Expand Up @@ -222,7 +226,9 @@ require("gitlinker").link({
})
```

> The `link` API is running in async way because it uses lua coroutine to avoid editor blocking.
> The `link` API is running in async mode and cannot directly returns the generated link, because it uses lua coroutine to avoid blocking IO.
</details>

### Recommended Key Mappings

Expand Down
2 changes: 1 addition & 1 deletion lua/gitlinker/commons/str.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ M.split = function(s, sep, opts)
assert(type(sep) == "string")
opts = opts or {
plain = true,
trimempty = true,
trimempty = false,
}
opts.plain = type(opts.plain) == "boolean" and opts.plain or true
opts.trimempty = type(opts.trimempty) == "boolean" and opts.trimempty or false
Expand Down
2 changes: 1 addition & 1 deletion lua/gitlinker/commons/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0.1
11.0.2
24 changes: 7 additions & 17 deletions spec/gitlinker_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ describe("gitlinker", function()
local assert_true = assert.is_true
local assert_false = assert.is_false

vim.opt.swapfile = false
vim.api.nvim_command("cd " .. cwd)
vim.cmd([[ edit lua/gitlinker.lua ]])
before_each(function()
vim.api.nvim_command("cd " .. cwd)
vim.opt.swapfile = false
vim.cmd([[edit lua/gitlinker.lua]])
end)

local gitlinker = require("gitlinker")
gitlinker.setup({
pcall(gitlinker.setup, {
debug = true,
file_log = true,
router = {
Expand Down Expand Up @@ -52,19 +55,6 @@ describe("gitlinker", function()
},
})

before_each(function() end)
after_each(function()
local done = false
vim.defer_fn(function()
done = true
end, 100)
for i = 1, 50 do
vim.wait(10, function()
return done
end)
end
end)

local routers = require("gitlinker.routers")

describe("[_url_template_engine]", function()
Expand Down

0 comments on commit 944a4b8

Please sign in to comment.