feat: upgrade dprint-plugin-markdown to 0.21.1 with heading_kind option#10
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Bump native dep 0.18.0 → 0.21.1; Configuration gains heading_kind and tags fields (both mandatory in the new version) - Add :heading_kind option (:atx | :setext, default :atx) across Config, Validator, and Native typespec; string form accepted in mix.exs - Hardcode Rust-side tags to HashMap::new() — no external formatter dispatch yet, not worth exposing - Activate DprintMarkdownFormatter.Config doctest via new config_test.exs - Fix to_nif_config/1 spec: line_width non_neg_integer → pos_integer - Fix format_elixir_source dialyzer warning on unreachable [] pattern Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Collapse 6 × 3 validate_option/2 clauses in Config into a single dispatch backed by an @atom_choices table plus a shared validate_atom_choice/2 helper; error messages unchanged (including Oxford comma for 3+ choices) - Introduce build_enum_option! macro in the NIF to generate 6 build_* functions from a single pattern; import the dprint enums directly so each call site fits on a few lines - No behavior change; 112 tests + dialyzer still green Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous iex> examples were removed because they would fail as doctests once the module's doctest was activated. Restore the example using a #=> comment so it's shown in generated docs without being executed as a test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The pattern-matching on `Code.format_string!/2` output directly works on Elixir 1.19 where dialyzer infers binary() | nonempty_improper_list(), but fails on Elixir 1.18 where the return type is [binary()] and the "" pattern cannot match. Normalize to binary first so the check is version-agnostic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Credo flags bare `_` as inconsistent with the project's `_foo` style. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dprint-plugin-markdown0.18.0 → 0.21.1 (3 minor versions; 0.21.0 never published to crates.io).dprint-corestays on 0.67.4 (already latest).:heading_kindoption (:atx|:setext, default:atx) across Config, Validator, Native typespec, and Mix formatter integration. String form ("atx"/"setext") accepted inmix.exslike other atom-choice fields.tags(also newly required by 0.21.1Configuration) hardcoded toHashMap::new()— the NIF'sformat_code_block_textcallback is still|_, _, _| Ok(None), so exposingtagshas no observable effect yet. Will ship alongside external-formatter dispatch when that lands.validate_option/2(6 × 3 clauses) collapsed into a single dispatch over an@atom_choicestable plusvalidate_atom_choice/2helper. Rust 6build_*functions generated from a singlebuild_enum_option!macro. Net -96 lines.typed_structorversion constraint (~> 0.5.0→~> 0.5).Incidental fixes
Config.to_nif_config/1spec:line_widthwasnon_neg_integer(), should bepos_integer()to match the struct.format_elixir_source: dead[] ->pattern (dialyzer warning on Elixir 1.19) cleaned up while preserving single-passIO.iodata_to_binary.Config.load/0doctest with environment-dependent output removed.Known behavior changes from dprint 0.21.1 upstream
None of the existing fixtures broke, but upstream notes flag (none triggered here):
Test plan
mix test— 28 doctests, 112 tests, 0 failures, 1 skippedmix dialyzer— 0 errorsmix format --check-formatted— cleancargo build/cargo fmt --check/cargo clippy --all-targets -- -D warnings— zero warningsformat("# Hello", heading_kind: :setext)→"Hello\n=====\n"; default atx preserved🤖 Generated with Claude Code