Skip to content

Preserve numeric 0 in YAML directive options - #49

Open
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/header-rows-zero
Open

Preserve numeric 0 in YAML directive options#49
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/header-rows-zero

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

parseDirectiveOptions stringified YAML option values with `${converted_value || ""}`. YAML/yaml.load turns header-rows: 0 (and :header-rows: 0) into numeric 0, which is falsy, so the convertor received "" and nonnegative_int threw OptionSpecError: Value is not set.

Switch to nullish coalescing so 0 is preserved. null/false are still mapped to "" before conversion, matching the previous flag/empty-option behavior.

Named cases:

  • YAML header-rows: 0 on list-table no longer throws
  • colon form :header-rows: 0 no longer throws
  • :header-rows: 1 still builds <thead>

Fixes #33

parseDirectiveOptions stringified option values with `|| ""`, so YAML
numeric 0 became an empty string and nonnegative_int threw "Value is
not set". Use nullish coalescing so 0 is kept; null/false still map
to empty string first.
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.

Value not set when it is zero

1 participant