mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-20 09:18:31 +02:00
docs: added recipes
This commit is contained in:
parent
0968e24f82
commit
9131897b61
1 changed files with 32 additions and 0 deletions
|
@ -129,6 +129,34 @@ import TabItem from '@theme/TabItem';
|
||||||
return { content = table.concat(lines, "\n") }
|
return { content = table.concat(lines, "\n") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.recipes()
|
||||||
|
local src = Util.read_file(vim.fs.normalize("~/projects/lazyvim.github.io/lua/recipes.lua"))
|
||||||
|
local lines = vim.split(src, "\n")
|
||||||
|
local ret = {}
|
||||||
|
local header = {} ---@type string[]
|
||||||
|
local block = {} ---@type string[]
|
||||||
|
for _, line in ipairs(lines) do
|
||||||
|
local comment = line:match("^ %-%- (.*)")
|
||||||
|
if comment then
|
||||||
|
header[#header + 1] = comment
|
||||||
|
elseif line:find("^ {") then
|
||||||
|
block = { "{" }
|
||||||
|
elseif line:find("^ }") then
|
||||||
|
block[#block + 1] = " }"
|
||||||
|
vim.list_extend(ret, header)
|
||||||
|
ret[#ret + 1] = "\n```lua"
|
||||||
|
local code = Docs.fix_indent(table.concat(block, "\n"))
|
||||||
|
ret[#ret + 1] = code
|
||||||
|
ret[#ret + 1] = "```\n"
|
||||||
|
header = {}
|
||||||
|
block = {}
|
||||||
|
else
|
||||||
|
block[#block + 1] = line
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return { content = table.concat(ret, "\n") }
|
||||||
|
end
|
||||||
|
|
||||||
function M.update2()
|
function M.update2()
|
||||||
local docs = vim.fs.normalize("~/projects/lazyvim.github.io/docs")
|
local docs = vim.fs.normalize("~/projects/lazyvim.github.io/docs")
|
||||||
|
|
||||||
|
@ -136,6 +164,10 @@ function M.update2()
|
||||||
general = M.general(),
|
general = M.general(),
|
||||||
}, docs .. "/configuration/general.md")
|
}, docs .. "/configuration/general.md")
|
||||||
|
|
||||||
|
Docs.save({
|
||||||
|
recipes = M.recipes(),
|
||||||
|
}, docs .. "/configuration/recipes.md")
|
||||||
|
|
||||||
Docs.save({
|
Docs.save({
|
||||||
lazy = {
|
lazy = {
|
||||||
content = [[```lua title="lua/config/lazy.lua"]] .. "\n" .. Util.read_file(
|
content = [[```lua title="lua/config/lazy.lua"]] .. "\n" .. Util.read_file(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue