diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-03-09 12:21:01 +0000 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-03-10 23:20:44 +0000 |
commit | a09ddd7ce55037edc9747a682810fba6a26bc201 (patch) | |
tree | 66f9888cf90c146d7ca366e4c919142d373d73b9 /scripts/text_utils.lua | |
parent | 09a919f313ec8ae691798e45ee459a4467ce5d6a (diff) | |
download | rneovim-a09ddd7ce55037edc9747a682810fba6a26bc201.tar.gz rneovim-a09ddd7ce55037edc9747a682810fba6a26bc201.tar.bz2 rneovim-a09ddd7ce55037edc9747a682810fba6a26bc201.zip |
docs(editorconfig): move to source
Diffstat (limited to 'scripts/text_utils.lua')
-rw-r--r-- | scripts/text_utils.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/text_utils.lua b/scripts/text_utils.lua index 937408c546..75b3bfedd5 100644 --- a/scripts/text_utils.lua +++ b/scripts/text_utils.lua @@ -318,7 +318,7 @@ local function align_tags(text_width) --- @param line string --- @return string return function(line) - local tag_pat = '%s+(%*[^ ]+%*)%s*$' + local tag_pat = '%s*(%*.+%*)%s*$' local tags = {} for m in line:gmatch(tag_pat) do table.insert(tags, m) @@ -327,7 +327,9 @@ local function align_tags(text_width) if #tags > 0 then line = line:gsub(tag_pat, '') local tags_str = ' ' .. table.concat(tags, ' ') - local pad = string.rep(' ', text_width - #line - #tags_str) + --- @type integer + local conceal_offset = select(2, tags_str:gsub('%*', '')) - 2 + local pad = string.rep(' ', text_width - #line - #tags_str + conceal_offset) return line .. pad .. tags_str end @@ -352,7 +354,7 @@ function M.md_to_vimdoc(text, start_indent, indent, text_width, is_list) local s = table.concat(lines, '\n') -- Reduce whitespace in code-blocks - s = s:gsub('\n+%s*>([a-z]+)\n?\n', ' >%1\n') + s = s:gsub('\n+%s*>([a-z]+)\n', ' >%1\n') s = s:gsub('\n+%s*>\n?\n', ' >\n') return s |