Skip to content

Commit

Permalink
docs: update README, auto generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sontungexpt committed Sep 23, 2023
1 parent efd8d27 commit 5dc215a
Show file tree
Hide file tree
Showing 14 changed files with 509 additions and 199 deletions.
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,27 @@ It provides the convenience of automatically detecting and highlighting all URLs
are using macos or windows and you have any problem with this plugin, please
open an issue or create a pull request to fix it

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- 🚀 [Features](#features)
- 👀 [Installation](#installation)
- 💻 [Configuration](#configuration)
- 😆 [Usage](#usage)
- 😁 [Contributing](#contributing)
- ✌️ [License](#license)

<!--toc:end-->

## Features

- Automatically detect and highlight all URLs within the text content and
- 🎨 Automatically detect and highlight all URLs within the text content and
provide visual cues when hovering over clickable URLs.
- Open the URLs under the cursor, including the Markdown link (e.g. `https://github.com/sontungexpt/url-open`).
- Open the GitHub page for the Neovim plugin mentioned under the cursor
- 🛠️ Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.
If one line has multiple URLs, the first URLs in the right side of cursor will be opened.
- 🎉 Open the URLs under the cursor, including the Markdown link (e.g. `https://github.com/sontungexpt/url-open`).
- ✈️ Open the GitHub page for the Neovim plugin mentioned under the cursor
(e.g. `Plug 'nvim-lua/plenary.nvim'`, "sontungexpt/url-open").
- Easily open the npm package specified in the package.json file. (e.g. `"lodash": "^4.17.21",`).
- 🍨 Easily open the npm package specified in the package.json file. (e.g. `"lodash": "^4.17.21",`).
- Extend support for recognized formats, including brew formulas and casks.
- Provide an optional deep pattern matching feature,
- 🚀 Provide an optional deep pattern matching feature,
which can be enabled, to accurately identify and handle various URL formats, such as:
- http://example.com
- https://www.example.com
Expand All @@ -38,13 +40,9 @@ open an issue or create a pull request to fix it
- http://example.com:8080
- https://www.example.com:8443
- ftp://ftp.example.com:2121
- Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.
If one line has multiple URLs, the first URLs in the right side of cursor will be opened.

## Preview

- Highlight url which can be opened then you can open it by `:OpenUrlUnderCursor`

![highlight-url](./docs/readme/preview1.png)

![highlight-all-url](./docs/readme/preview2.png)
Expand All @@ -60,7 +58,7 @@ https://github.com/sontungexpt/url-open/assets/92097639/c51b3e1c-8eae-48f0-a542-
{
"sontungexpt/url-open",
event = "VeryLazy"
cmd = "OpenUrlUnderCursor",
cmd = "URLOpenUnderCursor",
config = function()
local status_ok, url_open = pcall(require, "url-open")
if not status_ok then
Expand All @@ -80,7 +78,7 @@ https://github.com/sontungexpt/url-open/assets/92097639/c51b3e1c-8eae-48f0-a542-
"sontungexpt/url-open",
branch = "mini",
event = "VeryLazy"
cmd = "OpenUrlUnderCursor",
cmd = "URLOpenUnderCursor",
config = function()
local status_ok, url_open = pcall(require, "url-open")
if not status_ok then
Expand Down Expand Up @@ -130,7 +128,9 @@ require("url_open").setup({
-- suffix = ""
-- file_patterns = { "package%.json" }, -- support for only specific file match with pattern
-- excluded_file_patterns = {}, -- exclude file match with pattern
-- extra_condition = function() return true end, -- need to return boolean
-- extra_condition = function(pattern_found) -- the function will be called when pattern found and return boolean
-- return pattern_found ~= "version" and pattern_found ~= "proxy"
-- end,
-- },

-- Ex: ['["]([^%s]*)["]:'] = "https://www.npmjs.com/package/",
Expand All @@ -153,16 +153,18 @@ require("url_open").setup({

## Usage

- This plugin provide a command `:OpenUrlUnderCursor` to open url under cursor
| **Command** | **Description** |
| --------------------------- | ----------------------------------------- |
| `:URLOpenUnderCursor` | Open url under cursor |
| `:URLOpenHighlightAll` | Highlight all url in current buffer |
| `:URLOpenHighlightAllClear` | Clear all highlight url in current buffer |

- This plugin will not map any key by default, you can map it by yourself

```lua
vim.keymap.set("n", "gx", "<esc>:OpenUrlUnderCursor<cr>")
vim.keymap.set("n", "gx", "<esc>:URLOpenUnderCursor<cr>")
```

- You can also use command `:HighlightAllUrls` to highlight all urls in the buffer manually

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand Down
7 changes: 6 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h2>Modules</h2>
<li><a href="modules/url-open.modules.autocmd.html">url-open.modules.autocmd</a></li>
<li><a href="modules/url-open.modules.commands.html">url-open.modules.commands</a></li>
<li><a href="modules/url-open.modules.handlers.html">url-open.modules.handlers</a></li>
<li><a href="modules/url-open.modules.highlight.html">url-open.modules.highlight</a></li>
<li><a href="modules/url-open.modules.logger.html">url-open.modules.logger</a></li>
<li><a href="modules/url-open.modules.options.html">url-open.modules.options</a></li>
<li><a href="modules/url-open.modules.patterns.html">url-open.modules.patterns</a></li>
Expand Down Expand Up @@ -70,6 +71,10 @@ <h2>Modules</h2>
<td class="name" nowrap><a href="modules/url-open.modules.handlers.html">url-open.modules.handlers</a></td>
<td class="summary">Handlers for opening urls</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/url-open.modules.highlight.html">url-open.modules.highlight</a></td>
<td class="summary">The module for working with the highlight effects.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/url-open.modules.logger.html">url-open.modules.logger</a></td>
<td class="summary">This module provides a simple wrapper around vim.notify to make it easier to</td>
Expand All @@ -95,7 +100,7 @@ <h2>Topics</h2>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-22 09:34:57 </i>
<i style="float:right;">Last updated 2023-09-23 12:16:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
3 changes: 2 additions & 1 deletion docs/modules/url-open.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h2>Modules</h2>
<li><a href="../modules/url-open.modules.autocmd.html">url-open.modules.autocmd</a></li>
<li><a href="../modules/url-open.modules.commands.html">url-open.modules.commands</a></li>
<li><a href="../modules/url-open.modules.handlers.html">url-open.modules.handlers</a></li>
<li><a href="../modules/url-open.modules.highlight.html">url-open.modules.highlight</a></li>
<li><a href="../modules/url-open.modules.logger.html">url-open.modules.logger</a></li>
<li><a href="../modules/url-open.modules.options.html">url-open.modules.options</a></li>
<li><a href="../modules/url-open.modules.patterns.html">url-open.modules.patterns</a></li>
Expand Down Expand Up @@ -114,7 +115,7 @@ <h3>Usage:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-22 09:34:57 </i>
<i style="float:right;">Last updated 2023-09-23 12:16:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
21 changes: 9 additions & 12 deletions docs/modules/url-open.modules.autocmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h2>Modules</h2>
<li><strong>url-open.modules.autocmd</strong></li>
<li><a href="../modules/url-open.modules.commands.html">url-open.modules.commands</a></li>
<li><a href="../modules/url-open.modules.handlers.html">url-open.modules.handlers</a></li>
<li><a href="../modules/url-open.modules.highlight.html">url-open.modules.highlight</a></li>
<li><a href="../modules/url-open.modules.logger.html">url-open.modules.logger</a></li>
<li><a href="../modules/url-open.modules.options.html">url-open.modules.options</a></li>
<li><a href="../modules/url-open.modules.patterns.html">url-open.modules.patterns</a></li>
Expand Down Expand Up @@ -94,23 +95,19 @@ <h3>Parameters:</h3>
</li>
</ul>

<h3>Returns:</h3>
<ol>

<span class="types"><span class="type">nil</span></span>



</ol>


<h3>See also:</h3>
<ul>
<li><a href="../modules/url-open.html#Plugin.setup">url-open.setup</a></li>
<li><a href="../modules/url-open.modules.handlers.html#highlight_cursor_url">url-open.modules.handlers.highlight_cursor_url</a></li>
<li><a href="../modules/url-open.modules.handlers.html#set_url_effect">url-open.modules.handlers.set_url_effect</a></li>
<li><a href="../modules/url-open.modules.commands.html#">url-open.modules.commands</a></li>
<li><a href="../modules/url-open.modules.highlight.html#highlight_cursor_url">url-open.modules.highlight.highlight_cursor_url</a></li>
<li><a href="../modules/url-open.modules.highlight.html#change_color_highlight">url-open.modules.highlight.change_color_highlight</a></li>
</ul>

<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span>(<span class="string">"url-open.modules.autocmd"</span>).<span class="function-name">setup</span>(opts)</pre>
</ul>

</dd>
</dl>
Expand All @@ -120,7 +117,7 @@ <h3>See also:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-22 09:34:57 </i>
<i style="float:right;">Last updated 2023-09-23 12:16:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
11 changes: 6 additions & 5 deletions docs/modules/url-open.modules.commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h2>Modules</h2>
<li><a href="../modules/url-open.modules.autocmd.html">url-open.modules.autocmd</a></li>
<li><strong>url-open.modules.commands</strong></li>
<li><a href="../modules/url-open.modules.handlers.html">url-open.modules.handlers</a></li>
<li><a href="../modules/url-open.modules.highlight.html">url-open.modules.highlight</a></li>
<li><a href="../modules/url-open.modules.logger.html">url-open.modules.logger</a></li>
<li><a href="../modules/url-open.modules.options.html">url-open.modules.options</a></li>
<li><a href="../modules/url-open.modules.patterns.html">url-open.modules.patterns</a></li>
Expand All @@ -67,7 +68,7 @@ <h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#setup">setup (user_opts)</a></td>
<td class="summary">Setup the OpenUrlUnderCursor command and HighlightAllUrls command.</td>
<td class="summary">Setup the OpenUrlUnderCursor command and URLOpenHighlightAlls command.</td>
</tr>
</table>

Expand All @@ -83,7 +84,7 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<strong>setup (user_opts)</strong>
</dt>
<dd>
Setup the OpenUrlUnderCursor command and HighlightAllUrls command.
Setup the OpenUrlUnderCursor command and URLOpenHighlightAlls command.


<h3>Parameters:</h3>
Expand All @@ -99,8 +100,8 @@ <h3>Parameters:</h3>
<h3>See also:</h3>
<ul>
<li><a href="../modules/url-open.modules.handlers.html#open_url">url-open.modules.handlers.open_url</a></li>
<li><a href="../modules/url-open.modules.handlers.html#set_url_effect">url-open.modules.handlers.set_url_effect</a></li>
<li><a href="../modules/url-open.modules.handlers.html#change_color_highlight">url-open.modules.handlers.change_color_highlight</a></li>
<li><a href="../modules/url-open.modules.highlight.html#set_url_effect">url-open.modules.highlight.set_url_effect</a></li>
<li><a href="../modules/url-open.modules.highlight.html#change_color_highlight">url-open.modules.highlight.change_color_highlight</a></li>
</ul>

<h3>Usage:</h3>
Expand All @@ -116,7 +117,7 @@ <h3>Usage:</h3>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-22 09:34:57 </i>
<i style="float:right;">Last updated 2023-09-23 12:16:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
Loading

0 comments on commit 5dc215a

Please sign in to comment.