Skip to content

feat(lmd): inline cells render numbers and booleans as tostring would (bd-iqd6niat) - #852

Merged
cscheid merged 3 commits into
mainfrom
feature/bd-iqd6niat-lmd-inline-numbers
Oct 16, 2026
Merged

cscheid merged 3 commits into
mainfrom
feature/bd-iqd6niat-lmd-inline-numbers

Conversation

@cscheid

@cscheid cscheid commented Oct 16, 2026

Copy link
Copy Markdown
Member

Summary

q2 metadata hands lmd cells real Lua numbers and booleans (divergence D-num), so `{lmd} meta.version` with version: 12.1 failed the inline-cell contract ("evaluated to a number") and forced authors to write tostring(meta.version).

  • The inline-cell boundary (classify_inline_value in crates/pampa/src/lua/lmd.rs) now accepts integers, floats and booleans, alone and inside a list. A new scalar_text helper formats them through lua_tolstring, so the bare form and a hand-written tostring() cannot drift (3, 12.1, 1e+15, 3.0, true).
  • Block cells still reject numbers. Constructors inside a cell keep pandoc's strictness: pandoc.Strong(3) is an error in pandoc 3.11 too. Widening pampa's fuzzy inline layer is filed separately as bd-q4gnd5os, since it would be a new divergence from pandoc.
  • The NotInlines message and the stage hint list the new accepted values.
  • The lmd cells.qmd fixture gains a metadata numbers/booleans paragraph; cells.md.snap and errors.stderr.snap are updated accordingly (reviewed: only the new paragraph and the wording change).

Design decisions and the investigation (including the finding that pandoc never exposes YAML numbers as Lua numbers, and that it rejects pandoc.Strong(3)) are in claude-notes/plans/2026-10-16-lmd-inline-numbers.md. Related: bd-32nrymty ({{< meta key >}} with a YAML real renders an empty string; not fixed here).

Test plan

  • inline_cells_format_numbers_and_booleans_like_tostring (pampa, unit)
  • inline_cells_render_metadata_numbers_and_booleans (quarto-core, through LmdExecuteStage)
  • lmd_fixtures_render_as_snapshotted with the extended cells.qmd
  • cargo xtask verify --skip-hub-build green locally (14/14 steps, 16485 tests)
  • CI

🤖 Generated with Claude Code

cscheid and others added 2 commits October 16, 2026 08:44
…on + repro)

Plan skeleton with triage verdict (ready to design) and the design
question of where a Lua number becomes text, given divergence D-num
and the fact that pandoc itself rejects pandoc.Strong(3). Repro
fixture and captured output under lmd-inline-numbers-investigation/.
Sibling shortcode bug ({{< meta >}} with a YAML real renders nothing)
filed as bd-32nrymty.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… (bd-iqd6niat)

q2 metadata hands lmd cells real Lua numbers and booleans (divergence
D-num), so `{lmd} meta.version` with `version: 12.1` used to fail the
inline contract and force the author to write tostring(meta.version).
The inline-cell boundary now accepts Value::Integer / Number / Boolean,
alone and inside a list, formatting them through lua_tolstring (so the
bare form and a hand-written tostring() cannot drift) and reading the
result as a string. Block cells still reject numbers, and constructors
inside a cell keep pandoc's strictness (pandoc.Strong(3) is an error in
pandoc 3.11 too); widening the fuzzy layer is bd-q4gnd5os.

The NotInlines message and the stage hint list the new accepted values;
the lmd cells fixture gains a metadata numbers/booleans paragraph and
its snapshots are updated. Plan records the decisions (option b).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@posit-snyk-bot

posit-snyk-bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid
cscheid merged commit ad283a2 into main Oct 16, 2026
11 checks passed
@cscheid
cscheid deleted the feature/bd-iqd6niat-lmd-inline-numbers branch October 16, 2026 18:17
cscheid pushed a commit that referenced this pull request Oct 16, 2026
…hanges

Two lmd changes landed on main while PR #855 was open, and the page had
documented both as limitations:

- #850 (bd-7gqr148v): tables inside fragments are emitted as pandoc.Table,
  so Q-26-2 no longer lists them and the limitation bullet is gone.
- #852 (bd-iqd6niat): a top-level inline cell writes numbers and booleans
  as tostring would. The metadata examples drop tostring(); the page, Q-26-6
  and the catalog say where it is still needed: constructor arguments and
  inline cells spliced inside a fragment (bd-q4gnd5os tracks lifting that).

Example 02, the patterns fixture and its snapshot follow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants