diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-10-06 03:24:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-06 03:24:21 -0700 |
commit | 056009f74146b349c66790fbcba3130e85a6c6da (patch) | |
tree | b3e7f8f18724ef034594cd339674ce4a21d7fc78 /scripts/util.lua | |
parent | a2008118a0f22502d2f376ac31a97c4d70f960bc (diff) | |
download | rneovim-056009f74146b349c66790fbcba3130e85a6c6da.tar.gz rneovim-056009f74146b349c66790fbcba3130e85a6c6da.tar.bz2 rneovim-056009f74146b349c66790fbcba3130e85a6c6da.zip |
fix(docs): markdown instead of vimdoc in meta docstrings #30680
LuaLS/meta docstrings expect markdown, not vimdoc. This matters for lists, codeblocks, etc.
Also, line length doesn't matter for docstrings.
Diffstat (limited to 'scripts/util.lua')
-rw-r--r-- | scripts/util.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/util.lua b/scripts/util.lua index dda18fb807..5940221abe 100644 --- a/scripts/util.lua +++ b/scripts/util.lua @@ -175,15 +175,16 @@ end --- Prefixes each line in `text`. --- ---- Does not wrap, that's not important for "meta" files? (You probably want md_to_vimdoc instead.) +--- Does not wrap, not important for "meta" files? (You probably want md_to_vimdoc instead.) --- --- @param text string --- @param prefix_ string -function M.prefix(prefix_, text) - if (text):find('\n$') then - return text:gsub('([^\n]*)[\t ]*\n', prefix_ .. '%1\n') +function M.prefix_lines(prefix_, text) + local r = '' + for _, l in ipairs(vim.split(text, '\n', { plain = true })) do + r = r .. vim.trim(prefix_ .. l) .. '\n' end - return prefix_ .. text:gsub('([^\n]*)[\t ]*\n', '%1\n' .. prefix_) + return r end --- @param x string |