From c087db0473b3d8363e31135ef42d1290994075e6 Mon Sep 17 00:00:00 2001 From: vhyrro Date: Tue, 16 Jul 2024 09:28:08 +0200 Subject: [PATCH] fix: better formatting, properly handle complex keybind descriptions --- docgen/docgen.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docgen/docgen.lua b/docgen/docgen.lua index d794f8fc9..e79704073 100644 --- a/docgen/docgen.lua +++ b/docgen/docgen.lua @@ -597,29 +597,31 @@ docgen.generators = { local mnemonic = docgen.extract_mnemonic(comments) - local description = table.concat(comments, " ") - local err = docgen.check_comment_integrity(description) + local summary = comments[1] + local description = vim.list_slice(comments, 2) + local err = docgen.check_comment_integrity(summary) if err then log.error("Invalid keybind description:", err) end - table.insert(layout, "-
") - table.insert(layout, " ") + table.insert(layout, "
") + table.insert(layout, "") table.insert(layout, "") - table.insert(layout, string.format(" #### `%s` - %s", key, description)) + table.insert(layout, string.format("#### `%s` - %s", key, summary)) table.insert(layout, "") - table.insert(layout, " ") + table.insert(layout, "
") table.insert(layout, "") + table.insert(layout, description) table.insert(layout, string.format(" - Default map: `%s`", data.rhs)) if mnemonic then table.insert( layout, - string.format(" - Mnemonic: %s", docgen.format_mnemonic(mnemonic)) + string.format("- Mnemonic: %s", docgen.format_mnemonic(mnemonic)) ) end table.insert(layout, "") - table.insert(layout, "
") + table.insert(layout, "") table.insert(layout, "") end end