9 Commits
Author SHA1 Message Date
Vijay Janapa Reddi 70a6ec5f84 feat(binder): add markdown list-spacing check for bold lead-ins
A bold lead-in paragraph (e.g. **Step 2**: ...) immediately followed by a
list item with no blank line between them is parsed by Pandoc as one
paragraph, so the list marker can render inline. Add a markup check
(check markup --scope list-spacing) that flags this, extend the
format lists fixer to insert the blank line for bold lead-ins (not just
colon-terminated lead-ins), and cover both with tests.
2026-06-28 21:54:40 -04:00
Vijay Janapa Reddi cd06d697b7 feat(book): mitpress-spelling-dict check + mitpress-terms auto-fixer (§10.7) 2026-06-10 14:13:10 -04:00
Vijay Janapa Reddi 979ca523c6 feat(book): native percent-in-tables check + format target
Tables invert the prose convention and use the % symbol, not the word
'percent'. This adds enforcement on both sides, sharing one implementation
in cli/checks/percent_tables.py (matching the cli/checks/currency_style.py
pattern) so the fixer fixes exactly what the check flags:

- check:  'percent-in-tables' scope in the numbers group (validate.py),
          default=True → runs in book-check-numbers pre-commit + validate-dev
          CI automatically.
- fix:    native 'percent-tables' target in the format command
          (./book/binder format percent-tables), wired as the
          book-format-percent-tables pre-commit hook ahead of prettify so
          columns realign after the substitution shortens cells.

Detection reuses the header+separator pipe-table walk shared by the other
table checks, gated by a number-token before 'percent' so header labels and
'percentage points / pp' are never touched.
2026-06-10 13:10:32 -04:00
Vijay Janapa Reddi 7c9f85fa5d Make blanks formatter fence tracking ignore HTML comments
_collapse_blank_lines toggled code-block state on every ``` line,
but commented-out figures (<!-- ... -->) often contain partial code
blocks with unbalanced fences. One stray fence inverted the toggle for
the rest of the file, so real python cells were treated as prose and
their blank lines collapsed (observed in security_privacy.qmd, which
desynced at its first commented-out tikz block).

Skip fence tracking and blank collapsing inside HTML comment regions;
commented-out content passes through verbatim.
2026-06-06 11:47:26 -04:00
Vijay Janapa Reddi bb92b09bcc Extend Python formatter to executable LEGO cells and reformat corpus
The book-format-python hook's fence regex matched display blocks
(```python, ```{.python}) but skipped executable ```{python} cells,
so hand-aligned assignment columns accumulated unchecked in LEGO code
(931 aligned lines across 22 files).

Add a second formatting profile for executable cells:
- Black at 150 chars (keeps one-line fmt_* exports; the display-block
  70-char profile would explode them into multiline calls)
- --skip-string-normalization (preserves the corpus quote-style mix)
- #| option lines shielded with a sentinel (Black rewrites '#|' to
  '# |', which breaks Quarto cell options)
- no comment wrapping (LEGO box-drawing headers must not rewrap)
- blank-line runs collapsed to one inside cells, keeping cells compact
  and making output a fixed point for book-format-blanks, whose fence
  toggle can desync on commented-out partial code blocks

Apply the one-time mechanical reformat across both volumes. Black
verifies AST equivalence, so all cells are semantically unchanged;
binder math/code checks and the LEGO test suites pass.
2026-06-06 11:23:25 -04:00
Vijay Janapa Reddi 6860c2459f Centralize book checks in Binder CLI 2026-05-30 13:41:34 -04:00
Vijay Janapa Reddi e2e9095b00 precommit fixes 2026-03-04 13:07:08 -05:00
Vijay Janapa Reddi e3cc9f7af3 refactor: rename ml_ml_workflow files, consolidate CLI, and clean up scripts
Remove redundant ml_ prefix from ml_workflow chapter files and update all
Quarto config references. Consolidate custom scripts into native binder
subcommands and archive obsolete tooling.
2026-02-13 11:06:28 -05:00
Vijay Janapa Reddi a0a7f7c658 feat(binder): restructure CLI into check/fix/format hierarchy
Reorganize binder commands into a clean three-verb quality system:

  check   — grouped validation (refs, labels, headers, footnotes,
            figures, rendering) with --scope for granularity
  fix     — content management (headers, footnotes, glossary, images)
  format  — auto-formatters (blanks, python, lists, divs, tables)

Key changes:
- validate → check (with backward-compat alias)
- maintain → fix (with backward-compat alias)
- 17 flat checks grouped into 6 semantic categories
- --scope flag narrows to individual checks within a group
- New FormatCommand with native blanks/lists + script delegation
- Updated pre-commit hooks, VSCode extension, and help output
2026-02-12 23:37:56 -05:00