Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

bug: ordered_icons compares nil when marker conversion fails

Cerrado Apto para principiantes
#698 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 6 días

@mlsimon734 ya está trabajando en esto.

Desde el 30/9/2026.

  • #700 de @mlsimon734 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
lua
Área
tooling

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MeanderingProgrammer/render-markdown.nvim

Todos los issues de MeanderingProgrammer/render-markdown.nvim

Issues similares

Más issues de Lua

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.