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 2150fa3 commit 20b3c0c
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 154 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,33 @@ require("url_open").setup({
},
},
deep_pattern = false,
-- a list of patterns to open url under cursor
extra_patterns = {
-- [pattern] = prefix: string only or nil
-- [pattern] = {
-- prefix = "",
-- suffix = ""
-- file_patterns = { "package%.json" }, -- support for only specific file match with pattern
-- excluded_file_patterns = {}, -- exclude file match with pattern
-- 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,
-- {
-- pattern = '["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"',
-- prefix = "https://www.npmjs.com/package/",
-- suffix = "",
-- file_patterns = { "package%.json" },
-- excluded_file_patterns = nil,
-- extra_condition = function(pattern_found)
-- return not vim.tbl_contains({ "version", "proxy" }, pattern_found)
-- end,
-- },

-- Ex: ['["]([^%s]*)["]:'] = "https://www.npmjs.com/package/",
-- so the url will be https://www.npmjs.com/package/[pattern_found]
--
-- Ex: ['["]([^%s]*)["]:'] = {prefix = "https://www.npmjs.com/package/", suffix = "/issues"},
-- so the url will be https://www.npmjs.com/package/[pattern_found]/issues

-- E.g:
-- ['["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"'] = {
-- prefix = "https://www.npmjs.com/package/",
-- suffix = "",
-- file_patterns = { "package%.json" },
-- excluded_file_patterns = {},
-- extra_condition = function() return true end, -- need to return boolean

-- {
-- pattern = '["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"',
-- prefix = "https://www.npmjs.com/package/",
-- suffix = "/issues",
-- file_patterns = { "package%.json" },
-- excluded_file_patterns = nil,
-- extra_condition = function(pattern_found)
-- return not vim.tbl_contains({ "version", "proxy" }, pattern_found)
-- end,
-- },
--
-- so the url will be https://www.npmjs.com/package/[pattern_found]/issues
},
})
```
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.autocmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.handlers.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.highlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.logger.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h3>Parameters:</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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/url-open.modules.options.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h3>Fields:</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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
143 changes: 42 additions & 101 deletions docs/modules/url-open.modules.patterns.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ <h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#PATTERNS">PATTERNS</a></td>
<td class="summary">Default Patterns to match urls.</td>
<td class="summary">Default patterns to match urls</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#DEEP_PATTERN">DEEP_PATTERN</a></td>
<td class="summary">Deep Pattern to match urls from text.</td>
<td class="summary">Deep Pattern to match URLs from text.</td>
</tr>
</table>

Expand All @@ -92,99 +92,34 @@ <h2 class="section-header "><a name="Tables"></a>Tables</h2>
<strong>PATTERNS</strong>
</dt>
<dd>
Default Patterns to match urls. </p>

<p> Http(s) URL pattern
Matches URLs starting with "http://" or "https://"
Example: "http://example.com", "https://www.example.com"
Pattern: "(https?://[%w-<em>%.]+%.%w[%w-</em>%.%%%?%.:/+=&amp;%%[%]#&lt;>]*)"
Prefix: ""
Suffix: ""
File<em>patterns: All files
Extra</em>condition: None
Excluded<em>file</em>patterns: None
Note: This pattern is used to match urls in all files</p>


<p> Npm Package pattern
Matches npm package names
Example: "react", "react-dom"
Pattern: '<a href="[^%s]*">"</a>["]:%s<em>"[^"]</em>%d[%d%.]*"'
Prefix: "https://www.npmjs.com/package/"
Suffix: ""
File<em>patterns: "package%.json"
Extra</em>condition: pattern<em>found ~= "version" and pattern</em>found ~= "proxy"
Excluded<em>file</em>patterns: None
Note: This pattern is used to match npm packages in package.json files</p>

<p> Git Plugin pattern
Matches git plugin names
Example: "airblade/vim-gitgutter", "tpope/vim-fugitive"
Pattern: "<a href="[^%s~/]*/[^%s~/]*">\"'</a>[\"']"
Prefix: "https://github.com/"
Suffix: ""
File<em>patterns: All files except package.json and package-lock.json
Extra</em>condition: None
Excluded<em>file</em>patterns: "package%.json", "package%-lock%.json"
Note: This pattern is used to match git plugins in all files except package.json and package-lock.json</p>


<p> Brew Formula pattern
Matches brew formula names
Example: "bat", "exa"
Pattern: 'brew <a href="[^%s]*">"</a>["]'
Prefix: "https://formulae.brew.sh/formula/"
Suffix: ""
File<em>patterns: All files
Extra</em>condition: None
Excluded<em>file</em>patterns: None
Note: This pattern is used to match brew formulas in all files</p>

<p> Cask Formula pattern
Matches cask formula names
Example: "firefox", "google-chrome"
Pattern: 'cask <a href="[^%s]*">"</a>["]'
Prefix: "https://formulae.brew.sh/cask/"
Suffix: ""
File<em>patterns: All files
Extra</em>condition: None
Excluded<em>file</em>patterns: None
Note: This pattern is used to match cask formulas in all files</p>

<p> Cargo Package pattern
Matches cargo package names
Example: "serde", "serde<em>json"
Pattern: "^%s*([%w</em>]+)%s*="
Prefix: "https://crates.io/crates/"
Suffix: ""
File<em>patterns: "Cargo%.toml"
Extra</em>condition: not vim.tbl<em>contains({
"name",
"version",
"edition",
"authors",
"description",
"license",
"repository",
"homepage",
"documentation",
"keywords",
}, pattern</em>found)
Excluded<em>file</em>patterns: None
Note: This pattern is used to match cargo packages in Cargo.toml files
Default patterns to match urls


<h3>Fields:</h3>
<ul>
<li><span class="parameter">pattern</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
: Pattern to match urls (required)
</li>
<li><span class="parameter">prefix</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">nil</span></span>
: Prefix to add to the url
</li>
<li><span class="parameter">suffix</span>



<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">nil</span></span>
: Suffix to add to the url
</li>
<li><span class="parameter">file_patterns</span>



<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a>, <a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">nil</span></span>
: File patterns to match against
</li>
<li><span class="parameter">excluded_file_patterns</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a>, <a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">nil</span></span>
: File patterns to exclude
</li>
<li><span class="parameter">extra_condition</span>
<span class="types"><span class="type">function(pattern_found)</span>, <span class="type">boolean</span> or <span class="type">nil</span></span>
: A callback function will be called with the pattern found as argument. If the function returns false, the pattern will be ignored. If the function returns true, the pattern will be used.
</li>
</ul>

Expand All @@ -202,18 +137,24 @@ <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<strong>DEEP_PATTERN</strong>
</dt>
<dd>
Deep Pattern to match urls from text. This pattern will find urls in the following formats:
http://example.com
https://www.example.com
ftp://ftp.example.com
file:///path/to/file.txt
ssh://user@hostname
git://github.com/user/repo
http://example.com/path?param=value
https://www.example.com/another/path#section
http://example.com:8080
https://www.example.com:8443
ftp://ftp.example.com:2121

<p>Deep Pattern to match URLs from text. This pattern will find URLs in various formats.
Supported URL formats:</p>

<ul>
<li>http://example.com</li>
<li>https://www.example.com</li>
<li>ftp://ftp.example.com</li>
<li>file:///path/to/file.txt</li>
<li>ssh://user@hostname</li>
<li>git://github.com/user/repo</li>
<li>http://example.com/path?param=value</li>
<li>https://www.example.com/another/path#section</li>
<li>http://example.com:8080</li>
<li>https://www.example.com:8443</li>
<li>ftp://ftp.example.com:2121</li>
</ul>




Expand All @@ -229,7 +170,7 @@ <h2 class="section-header "><a name="Fields"></a>Fields</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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down
50 changes: 26 additions & 24 deletions docs/topics/README.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ <h2>Features</h2>
<li>✈️ Open the GitHub page for the Neovim plugin mentioned under the cursor
(e.g. <code>Plug &apos;nvim-lua/plenary.nvim&apos;</code>, "sontungexpt/url-open").</li>
<li>🍨 Easily open the npm package specified in the package.json file. (e.g. <code>&quot;lodash&quot;: &quot;^4.17.21&quot;,</code>).</li>
<li>Extend support for recognized formats, including brew formulas and casks.</li>
<li>🍻 Open the Homebrew formula or cask specified in the Brewfile.</li>
<li>🍕 Open the cargo package specified in the Cargo.toml file.</li>
<li>🚀 Provide an optional deep pattern matching feature,
which can be enabled, to accurately identify and handle various URL formats, such as:</li>
<li>http://example.com</li>
Expand Down Expand Up @@ -190,32 +191,33 @@ <h2>Configuration</h2>
},
},
deep_pattern = <span class="keyword">false</span>,
extra_patterns = {
<span class="comment">-- [pattern] = prefix: string only or nil
</span> <span class="comment">-- [pattern] = {
</span> <span class="comment">-- prefix = "",
</span> <span class="comment">-- suffix = ""
</span> <span class="comment">-- file_patterns = { "package%.json" }, -- support for only specific file match with pattern
</span> <span class="comment">-- excluded_file_patterns = {}, -- exclude file match with pattern
</span> <span class="comment">-- extra_condition = function(pattern_found) -- the function will be called when pattern found and return boolean
</span> <span class="comment">-- return pattern_found ~= "version" and pattern_found ~= "proxy"
</span> <span class="comment">-- end,
<span class="comment">-- a list of patterns to open url under cursor
</span> extra_patterns = {
<span class="comment">-- {
</span> <span class="comment">-- pattern = '["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"',
</span> <span class="comment">-- prefix = "https://www.npmjs.com/package/",
</span> <span class="comment">-- suffix = "",
</span> <span class="comment">-- file_patterns = { "package%.json" },
</span> <span class="comment">-- excluded_file_patterns = nil,
</span> <span class="comment">-- extra_condition = function(pattern_found)
</span> <span class="comment">-- return not vim.tbl_contains({ "version", "proxy" }, pattern_found)
</span> <span class="comment">-- end,
</span> <span class="comment">-- },
</span>
<span class="comment">-- Ex: ['["]([^%s]*)["]:'] = "https://www.npmjs.com/package/",
</span> <span class="comment">-- so the url will be https://www.npmjs.com/package/[pattern_found]
</span> <span class="comment">--
</span> <span class="comment">-- Ex: ['["]([^%s]*)["]:'] = {prefix = "https://www.npmjs.com/package/", suffix = "/issues"},
</span> <span class="comment">-- so the url will be https://www.npmjs.com/package/[pattern_found]/issues
</span>
<span class="comment">-- E.g:
</span> <span class="comment">-- ['["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"'] = {
</span> <span class="comment">-- prefix = "https://www.npmjs.com/package/",
</span> <span class="comment">-- suffix = "",
</span> <span class="comment">-- file_patterns = { "package%.json" },
</span> <span class="comment">-- excluded_file_patterns = {},
</span> <span class="comment">-- extra_condition = function() return true end, -- need to return boolean

<span class="comment">-- {
</span> <span class="comment">-- pattern = '["]([^%s]*)["]:%s*"[^"]*%d[%d%.]*"',
</span> <span class="comment">-- prefix = "https://www.npmjs.com/package/",
</span> <span class="comment">-- suffix = "/issues",
</span> <span class="comment">-- file_patterns = { "package%.json" },
</span> <span class="comment">-- excluded_file_patterns = nil,
</span> <span class="comment">-- extra_condition = function(pattern_found)
</span> <span class="comment">-- return not vim.tbl_contains({ "version", "proxy" }, pattern_found)
</span> <span class="comment">-- end,
</span> <span class="comment">-- },
</span> <span class="comment">--
</span> <span class="comment">-- so the url will be https://www.npmjs.com/package/[pattern_found]/issues
</span> },
})
</pre>
Expand Down Expand Up @@ -252,7 +254,7 @@ <h2>License</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-23 12:16:00 </i>
<i style="float:right;">Last updated 2023-09-23 15:22:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

Expand Down

0 comments on commit 20b3c0c

Please sign in to comment.