docs: added footer

This commit is contained in:
Folke Lemaitre 2024-06-23 20:28:46 +02:00
parent 9ea70beda8
commit b083bb5dc8
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
3 changed files with 38 additions and 24 deletions

View File

@ -0,0 +1,3 @@
## 🚀 Getting Started
Check the [documentation website](https://lazy.folke.io/) for more information.

View File

@ -30,7 +30,7 @@
</a> </a>
</div> </div>
# 🚀 Getting Started
**lazy.nvim** is a modern plugin manager for Neovim. **lazy.nvim** is a modern plugin manager for Neovim.
@ -61,3 +61,7 @@
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**) - Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
- Git >= **2.19.0** (for partial clones support) - Git >= **2.19.0** (for partial clones support)
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_** - a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
## 🚀 Getting Started
Check the [documentation website](https://lazy.folke.io/) for more information.

View File

@ -86,7 +86,9 @@ end
---@param readme? string ---@param readme? string
---@param mds? string[] ---@param mds? string[]
function M.readme(readme, mds) ---@param transform? fun(s:string):string
function M.readme(readme, mds, transform)
local is_sorted = mds ~= nil
readme = readme or "README.md" readme = readme or "README.md"
mds = mds mds = mds
or vim.fs.find(function(name, path) or vim.fs.find(function(name, path)
@ -101,27 +103,29 @@ function M.readme(readme, mds)
"usage", "usage",
"developers", "developers",
} }
table.sort(mds, function(a, b) if not is_sorted then
local aa = 0 table.sort(mds, function(a, b)
local bb = 0 local aa = 0
for i, name in ipairs(sorters) do local bb = 0
if a:match(name) then for i, name in ipairs(sorters) do
aa = i if a:match(name) then
aa = i
end
if b:match(name) then
bb = i
end
end end
if b:match(name) then if aa == bb then
bb = i if a:match("index") then
return true
elseif b:match("index") then
return false
end
return a < b
end end
end return aa < bb
if aa == bb then end)
if a:match("index") then end
return true
elseif b:match("index") then
return false
end
return a < b
end
return aa < bb
end)
local text = "" local text = ""
for _, md in ipairs(mds) do for _, md in ipairs(mds) do
local _, level = md:gsub("/", "") local _, level = md:gsub("/", "")
@ -129,6 +133,7 @@ function M.readme(readme, mds)
if md:match("index") then if md:match("index") then
level = level - 1 level = level - 1
end end
level = math.max(0, level)
local t = Util.read_file(md) .. "\n\n" local t = Util.read_file(md) .. "\n\n"
-- remove frontmatter -- remove frontmatter
t = t:gsub("^%-%-%-.-%-%-%-\n", "") t = t:gsub("^%-%-%-.-%-%-%-\n", "")
@ -151,6 +156,7 @@ function M.readme(readme, mds)
text = text .. "\n\n" .. vim.trim(t) text = text .. "\n\n" .. vim.trim(t)
end end
text = vim.trim(text) text = vim.trim(text)
text = transform and transform(text) or text
Util.write_file(readme, text) Util.write_file(readme, text)
end end
@ -159,9 +165,10 @@ function M.update()
M.readme("README.md", { M.readme("README.md", {
"README.header.md", "README.header.md",
"docs/intro.md", "docs/intro.md",
-- "docs/installation.mdx",
"README.footer.md", "README.footer.md",
}) }, function(s)
return s:gsub("\n# 🚀 Getting Started", "\n")
end)
M.themes() M.themes()
M.docs() M.docs()
vim.cmd.checktime() vim.cmd.checktime()