Skip to content

Commit

Permalink
Only render bullet point in lists that use +, -, or *. Essentially ig…
Browse files Browse the repository at this point in the history
…nore ordered lists.
  • Loading branch information
MeanderingProgrammer committed Mar 23, 2024
1 parent 70f8f4f commit f5917d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ require('render-markdown').setup({
(fenced_code_block) @code
(list_item) @item
(list_marker_plus) @list_marker
(list_marker_minus) @list_marker
(list_marker_star) @list_marker
(pipe_table_header) @table_head
(pipe_table_delimiter_row) @table_delim
Expand Down
8 changes: 5 additions & 3 deletions lua/render-markdown/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function M.setup(opts)
(fenced_code_block) @code
(list_item) @item
(list_marker_plus) @list_marker
(list_marker_minus) @list_marker
(list_marker_star) @list_marker
(pipe_table_header) @table_head
(pipe_table_delimiter_row) @table_delim
Expand Down Expand Up @@ -168,8 +170,8 @@ M.handle_markdown = function(tree)
hl_group = highlights.code,
hl_eol = true,
})
elseif capture == 'item' then
-- List items from tree-sitter should have leading spaces removed, however there are known
elseif capture == 'list_marker' then
-- List markers from tree-sitter should have leading spaces removed, however there are known
-- edge cases in the parser: https://github.com/tree-sitter-grammars/tree-sitter-markdown/issues/127
-- As a result we handle leading spaces here, can remove if this gets fixed upstream
local _, leading_spaces = value:find('^%s*')
Expand Down

0 comments on commit f5917d2

Please # to comment.