diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-04-02 06:33:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-02 06:33:41 -0700 |
| commit | 171b6df1ad1bb3ee7ef115191ae5e473004b2872 (patch) | |
| tree | 598608b9c708996c81df3d66ae9ace5eb440da72 /scripts/docgen.lua | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar.gz nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar.bz2 nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar.lz nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar.xz nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.tar.zst nvim-lspconfig-171b6df1ad1bb3ee7ef115191ae5e473004b2872.zip | |
fix(docgen): :help (vimdoc) format #3683
followup to #3675
Diffstat (limited to 'scripts/docgen.lua')
| -rwxr-xr-x | scripts/docgen.lua | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/scripts/docgen.lua b/scripts/docgen.lua index bab89851..2f7d114e 100755 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -61,37 +61,32 @@ local function readfile(path) return io.open(path):read '*a' end -local function relpath(from, to) - return to:gsub('^' .. vim.pesc(from) .. '/', '') -end - -local lsp_section_template_txt = [[ -============================================================================== -{{tagline}} +local section_template_txt = [[ +------------------------------------------------------------------------------ +{{config_name}} {{preamble}} -Snippet to enable the language server: -```lua -require'lspconfig'.{{config_name}}.setup{} -``` +Snippet to enable the language server: >lua + require'lspconfig'.{{config_name}}.setup{} + {{commands}} Default config: {{default_values}} ]] -local lsp_section_template_md = [[ +local section_template_md = [[ ## {{config_name}} {{preamble}} -**Snippet to enable the language server:** +Snippet to enable the language server: ```lua require'lspconfig'.{{config_name}}.setup{} ``` {{commands}} -**Default config:** +Default config: {{default_values}} --- @@ -130,8 +125,6 @@ local function make_lsp_sections(is_markdown) preamble = '', commands = '', default_values = '', - tagline = is_markdown and '' - or string.format('%s *%s*', config_name, config_name), } params.commands = make_section(0, '\n', { @@ -173,7 +166,7 @@ local function make_lsp_sections(is_markdown) end end io.close(file) - local config_relpath = relpath(root, config_file) + local config_relpath = vim.fs.relpath(root, config_file) -- XXX: "../" because the path is outside of the doc/ dir. return ('- `%s` source (use "gF" to visit): [../%s:%d](../%s#L%d)'):format( @@ -281,7 +274,7 @@ local function make_lsp_sections(is_markdown) params.preamble = vim.trim(table.concat(preamble_parts, '\n')) end - local template_used = is_markdown and lsp_section_template_md or lsp_section_template_txt + local template_used = is_markdown and section_template_md or section_template_txt return template(template_used, params) end) ) |
