bug: ordered_icons compares nil when marker conversion fails
Los mantenedores suelen responder en 6 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 86/100
Línea de trabajo
Comienza en lua/render-markdown/settings.lua, en el callback predeterminado bullet.ordered_icons, y ejecuta la reproducción proporcionada de Neovim en modo headless. Añade cobertura de regresión para valores de marcador vacíos y no numéricos, preservando el comportamiento de numeración válido; la tarea estará terminada cuando el callback ya no genere errores y los casos válidos existentes permanezcan sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Neovim version
NVIM v0.12.5 (LuaJIT 2.1.1788856981)
Neovim distribution / OS / terminal
LazyVim on macOS. The deterministic reproduction below uses headless Neovim; the terminal for the original editing error was not recorded.
Describe the bug
The default bullet.ordered_icons callback calls tonumber(...), then compares the result with 1 without checking for nil. If the supplied marker text cannot be converted to a number, rendering aborts with:
Error msg_show.lua_error vim.schedule callback:
.../render-markdown.nvim/lua/render-markdown/settings.lua:164: attempt to compare number with nil
stack traceback:
.../settings.lua:164: in function 'get_string'
.../render/markdown/bullet.lua:44: in function 'setup'
.../render/base.lua:20: in function 'execute'
.../render/markdown/list.lua:18: in function 'run'
.../render/base.lua:21: in function 'execute'
.../handler/markdown.lua:58: in function 'callback'
.../request/view.lua:76: in function 'callback'
.../request/view.lua:88: in function 'query'
.../request/view.lua:71: in function 'nodes'
.../handler/markdown.lua:55: in function 'parse'
.../core/handlers.lua:94: in function 'tree'
.../core/handlers.lua:51: in function 'run'
.../core/ui.lua:156: in function 'callback'
This was reported during a real editing session on 8.14.0 (640a3ec6d538bad17c328be373c7cad0293d9589). I have verified the unsafe conversion/comparison, but have not captured the original marker text or reproduced the sequence of editing/parser events that supplied it. An incomplete or stale marker is a hypothesis, not an established cause.
Deterministic callback reproduction
With the plugin on runtimepath, execute:
local ordered_icons = require('render-markdown.settings').bullet.default.ordered_icons
ordered_icons({ level = 1, index = 3, value = '' })
This raises the exact settings.lua:164 comparison error. value = '.', ')', or 'abc' also reproduces it. These are injected callback inputs, not a claim that standalone malformed Markdown necessarily produces an ordered-list parser node.
For example, with a fresh checkout:
nvim --headless -u NONE -i NONE \
--cmd 'set rtp+=/path/to/render-markdown.nvim' \
-c 'lua local f = require("render-markdown.settings").bullet.default.ordered_icons; local ok, result = pcall(f, { level = 1, index = 3, value = "" }); print(ok, result)' \
-c qa
Observed: false .../settings.lua:164: attempt to compare number with nil.
Expected behavior / proposed fix
A failed marker conversion should not abort rendering. Guard the comparison and reuse the callback's existing item-index fallback:
return ('%d.'):format(index and index > 1 and index or ctx.index)
Verified in headless Neovim: valid explicit markers greater than one retain their number; markers starting at zero or one retain the existing item-position numbering; unconvertible marker strings fall back to ctx.index without crashing. A regression test fails before this guard and passes afterward.
Plugin configuration at the time of the error
Custom overrides for this plugin (remaining options inherited from LazyVim):
opts = {
latex = { block = false },
anti_conceal = { ignore = { virtual_lines = false } },
}
There was no custom bullet.ordered_icons callback. A local override using the proposed guard is now in place.
Healthcheck output
Collected headlessly with the above overrides and installed parser/icon dependencies in an isolated checkout. This is a minimal configuration healthcheck, not a capture of the original live editor session:
==============================================================================
render-markdown: ✅
render-markdown.nvim [versions] ~
- ✅ OK neovim >= 0.11
- ✅ OK tree-sitter ABI: 15
- ✅ OK plugin: 8.14.0
render-markdown.nvim [configuration] ~
- ✅ OK valid
render-markdown.nvim [tree-sitter markdown] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
- ✅ OK highlights: ~/.local/share/nvim/site/queries/markdown/highlights.scm
- ✅ OK highlighter: enabled
render-markdown.nvim [tree-sitter markdown_inline] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
- ✅ OK highlights: ~/.local/share/nvim/site/queries/markdown_inline/highlights.scm
render-markdown.nvim [tree-sitter html] ~
- ✅ OK parser: installed
- ✅ OK ABI: 14
render-markdown.nvim [tree-sitter latex] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
render-markdown.nvim [tree-sitter yaml] ~
- ✅ OK parser: installed
- ✅ OK ABI: 15
render-markdown.nvim [icons] ~
- ✅ OK using: mini.icons
render-markdown.nvim [latex] ~
- ✅ OK using: { "utftex", "latex2text" }
render-markdown.nvim [conflicts] ~
- ✅ OK headlines: not installed
- ✅ OK markview: not installed
- ✅ OK obsidian: not installed
- ✅ OK snacks: not installed
Plugin error log
The original scheduled-callback traceback is included above; a separate plugin error-log capture is unavailable.
Additional verification
A fresh checkout of current main has the same default callback and commit as the installed 8.14.0 version. The callback reproduction does not require a Tree-sitter parser, so parsers were not updated as part of this diagnosis. This differs from #504, which involved the pre-8.0 callback signature in user configuration.
- Lenguaje dominante
- Lua
- Estrellas
- 5.1k
- Forks
- 144
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MeanderingProgrammer/render-markdown.nvim
-
bug
Dificultad 4/5 1-2 días Aptitud para principiantes 55/100
MeanderingProgrammer/render-markdown.nvim#706 ·
Los mantenedores suelen responder en 6 días
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
MeanderingProgrammer/render-markdown.nvim#685 ·
Los mantenedores suelen responder en 6 días
-
bug: Tables don't render correctly if the pipe at the end of line is missingPosiblemente ocupada @samholmes la tomó hace 92 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
MeanderingProgrammer/render-markdown.nvim#673 · 2 comentarios ·
Los mantenedores suelen responder en 6 días
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
MeanderingProgrammer/render-markdown.nvim#656 ·
Los mantenedores suelen responder en 6 días
Todos los issues de MeanderingProgrammer/render-markdown.nvim
Issues similares
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
-
bug ready ticket
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Domktorymysli/vclu#5 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 3 días
-
Campaign WC
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día