Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug: ordered_icons compares nil when marker conversion fails

Chiusa Adatta ai principianti
#698 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@mlsimon734 ci sta già lavorando.

Dal 30/9/2026.

  • #700 di @mlsimon734 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
lua
Ambito
tooling

Direzione di ricerca

Inizia in lua/render-markdown/settings.lua, nel callback predefinito bullet.ordered_icons, ed esegui la riproduzione headless fornita di Neovim. Aggiungi una copertura di regressione per i valori dei marcatori vuoti e non numerici, preservando il comportamento di numerazione valido; il lavoro è completato quando il callback non solleva più errori e i casi validi esistenti rimangono invariati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Lua
Stelle
5.1k
Fork
144
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MeanderingProgrammer/render-markdown.nvim

Tutte le issue di MeanderingProgrammer/render-markdown.nvim

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.