dapper 1.5.0
dapper: ^1.5.0 copied to clipboard
A simple Markdown and YAML formatter for Dart, inspired by Prettier.
1.5.0 #
Fixed #
- Fix
MarkdownPrintercorrupting a link whose label contains auto-linkable email/URL text into a nested link.package:markdown's GFM autolink extension auto-links such text even inside another link's label, producing a nestedaelement that was re-wrapped:[a@b.com](mailto:a@b.com)became[[a@b.com](mailto:a@b.com)](mailto:a@b.com), and[see https://example.com here](https://other.com)became[see [https://example.com](https://example.com) here](https://other.com). This also made<a@b.com>and barea@b.comnon-idempotent, since their first-pass output[a@b.com](mailto:a@b.com)was corrupted on the next pass._renderInlineNodenow renders ananested inside a link's label as plain text instead of re-wrapping it.
Changed #
- Raise the
globconstraint to^2.2.0. Starting with glob 2.2.0,**matches zero directories at the start of a pattern or following a separator, so ignore patterns such as**/buildnow matchbuildandfoo/**/barnow matchesfoo/bar, aligningIgnorePatternwith git's own gitignore semantics. - Restore the whitespace-only line inside the code block of the
handles nested list code block with blank linestest input, which had been replaced by an empty line, and spell the input out with explicit\nescapes so trailing whitespace cannot be stripped from it again.
Added #
- Add tests for a link whose label contains an auto-linked URL mid-text, and for the idempotency of
<a@b.com>and barea@b.comemail autolinks.
1.4.8 #
Changed #
- Remove duplicated inline-print methods (
_printInlineCode,_printEmphasis,_printStrong,_printLink,_printImage) inast_printer.dartand collapse the matching_printElementcases (code/em/strong/a/img) into a single arm that shares_renderInlineNode's output. - Extract
_renderLinkLikehelper inast_printer.dartso the'a'and'img'cases of_renderInlineNodeshare the title-vs-no-title spelling instead of duplicating the three-line ternary. - Decompose
_printMapinyaml_formatter.dartinto_positionMapKey,_isInlineMapValue, and_writeMapValueso the previously nested key-positioning conditional reads as three named cases and value emission lives in a single helper. - Extract
_writeGapCommenthelper inyaml_formatter.dartto separate per-line comment formatting (inline-with-previous vs. indent-rounded standalone) from the gap-line iteration in_printGap. - Extract
_tryParseDefinitionListAtindefinition_list.dartsoparseDocumentSegmentsorchestrates segment dispatch while definition-list parsing lives in a single-responsibility helper.
1.4.7 #
Fixed #
- Fix
parseDocumentSegmentsallowing a single blank line between definitions only for the first term; the same rule now applies to every term so definition lists with blank-separated entries on later terms are parsed consistently.
Changed #
- Extract
_collectDefinitionshelper indefinition_list.dartto consolidate the two near-duplicate definition-collection loops inparseDocumentSegments. - Extract
_writeWrappedListItemLinehelper inast_printer.dartso the inline-only and block-mixed paths of_printListItemContentshare a single prose-wrap output policy. - Split
_printTableinast_printer.dartinto_collectTableRows,_collectTableRowCells,_computeColumnWidths, and_writeTableSeparatorso the top-level body reads as a collect / measure / print pipeline. - Introduce
_atLineStartand_endsWithSpacegetters in_YamlPrinterto name the recurring buffer-state checks that previously appeared inline as_buffer.toString().endsWith(...).
Added #
- Add stronger edge-case tests for
parseDocumentSegmentsthat verify the collected terms and definitions (including blank lines between definitions of later terms), replacing the priorlength >= 1smoke checks.
1.4.6 #
Fixed #
- Fix
_parseOptionsMaphardcoding default values instead of usingFormatOptions.defaults.copyWith(). - Fix
numvariable shadowing built-innumtype in ordered list formatting. - Fix stdout leaking into test output from
run_test.dart.
Changed #
- Cache
RegExpobjects at module level intext_utils.dartandyaml_formatter.dartto avoid recompilation per call. - Use
Setliteral instead ofListfor inline tag lookup in_isInlineand YAML reserved word check in_needsQuoting. - Simplify
dart:ioimports indapper_cli.dartfrom two overlapping imports to a singlehideclause. - Simplify
_resolveOptionsto useFormatOptions.defaults.copyWith(). - Remove dead methods:
_printListItem,_printTableSection,_printTableRow,_printTableCell. - Consolidate table-related switch cases (
thead,tbody,tr,th,td) into a single shared case. - Extract YAML reserved words to a top-level
const Setfor_needsQuoting. - Hide internal
basenamefunction from public API viashowclause onlib/bin.dartexport. - Clean up development comments and normalize code style (
varfor type-inferred locals). - Add
library;declarations and doc comments to alllib/bin/files for consistency. - Add description line to
yaml_formatter.dartlibrary doc comment. - Add doc comments to
ExitCode,OutputMode, andProcessResultenum values.
Added #
- Add
countTrailingNewlinesto sharedtext_utils.dart, replacing duplicated implementations in markdown and YAML formatters. - Add
ulStyleto Option Applicability table inoptions.dartdoc comment. - Add
file_system.darttoAGENTS.mdarchitecture diagram. - Add tests for
ConfigLoader: non-existent directory, camelCase options,ul_styleshorthands, invalid config, missing dapper block, string integer parsing. - Add tests for
FormatOptions:ulStyledefaults,copyWith(ulStyle:),UnorderedListStyleenum,toStringwithulStyle. - Add tests for
countTrailingNewlinesintext_utils_test.dart.
1.4.5 #
Fixed #
- Fix inline images losing
titleattribute when rendered inside paragraphs or list items (e.g.,). - Fix redundant O(n) key lookup per entry in YAML map formatting.
- Fix hardcoded 4-space checkbox continuation indent to use actual prefix length.
Changed #
- Remove unused normalization functions from
normalizer.dart(normalizeEmphasis,normalizeHorizontalRule,normalizeUnorderedListMarker,orderedListContentIndent,normalizeCodeFence) — these were superseded by AST-based formatting. - Remove unused utility functions from
text_utils.dart(displayWidth,indent,repeat,trimTrailingWhitespace).
Added #
- Add idempotency integration tests for Markdown and YAML formatting.
- Add integration test for inline image
titleattribute in list items.
1.4.4 #
Refactored #
- Internal: Refactored CLI entrypoint (
bin/dapper.dart) to follow best practices:- Added POSIX-compliant shebang (
#!/usr/bin/env dart). - Replaced unsafe
exit()calls withexitCodesetter. - Added top-level error handling.
- Extracted execution logic to
dapper.run()inlib/bin/dapper_cli.dart.
- Added POSIX-compliant shebang (
1.4.3 #
Fixed #
- Fix broken indentation and layout when formatting loose lists (lists with blank lines).
1.4.1 #
Fixed #
- Fix space accumulation on blank lines in nested code blocks.
Added #
- Added
strict-casts,strict-inference, andstrict-raw-typestoanalysis_options.yamlfor stronger type safety. - Added additional defensive linter rules:
avoid_catching_errors,cancel_subscriptions,close_sinks,directives_ordering,no_adjacent_strings_in_list,only_throw_errors,prefer_const_constructors_in_immutables,sort_constructors_first,test_types_in_equals,unnecessary_statements,use_super_parameters. - Added
prefer_relative_importsto linter rules. - Add execution time and file statistics to CLI output.
Changed #
- Refactor: Use relative imports in
lib/bin/to improve code organization. - Fix: Add explicit type arguments to
FutureandIterablein tests to satisfy strict mode.
1.4.0 #
Changed #
- Internal: Remove dead code in Markdown printer related to checkbox list items.
- Internal: Remove duplicate
_ensureTrailingNewlinein YAML formatter, reusetext_utils.dart. - Internal: Clean up development notes and verbose comments in code.
- Internal: Move CLI modules from
bin/src/tolib/bin/for coverage and reusability. - Internal: Split
test/cli_test.dartintotest/bin/for better organization.
Added #
- Add
FileSystemabstraction inlib/bin/for testability (100% coverage). - Add
lib/bin.dartexporting CLI utilities (DapperCli,ConfigLoader,IgnoreRules). - Add
AGENTS.mdfor AI agent design guidelines.
1.3.7 #
Fixed #
- Fix unnecessary newline insertion after list items containing code blocks.
- Fix data loss when formatting checkbox list items with block content (e.g., code blocks).
- Fix data loss and incorrect structure when formatting nested blockquotes.
- Fix whitespace handling in paragraphs to ensure proper trimming, especially within blockquotes.
1.3.6 #
1.3.4 #
Fixed #
- Fix YAML block scalars (
|and>) being converted to double-quoted strings (e.g., in GitHub Actions workflows)
1.3.3 #
1.3.2 #
1.3.1 #
Changed #
- Change default Markdown unordered list style in the CLI from
-(dash) to*(asterisk).
1.3.0 #
Changed #
- Change default Markdown unordered list style from
-(dash) to*(asterisk) to match Prettier's default behavior.
1.2.0 #
Added #
- Add
.dapperignoreand.gitignoresupport for excluding files and directories- Glob pattern matching (e.g.,
*.generated.md) - Negation patterns to override defaults (e.g.,
!build) - Nested ignore file support (child directories inherit parent rules)
- Glob pattern matching (e.g.,
1.1.0 #
Fixed #
- Add missing
executablessection to enabledart pub global activate dapperto work correctly - Add
.pubignoreto reduce package size
1.0.1 #
Fixed #
- Normalize extra whitespace in list items (
* Item→* Item) - Normalize extra whitespace in headings (
# Title→# Title) - Normalize extra whitespace in blockquotes (
> Text→> Text)
Changed #
- Improved integration tests for messy input handling
- Updated example to demonstrate whitespace normalization
1.0.0 #
Initial release of Dapper * A simple Markdown and YAML formatter for Dart.
Features #
Markdown Formatting
- Emphasis normalization (
*text*→_text_) - List formatting with proper alignment (ordered and unordered)
- Configurable list bullet style (
-,*,+) - Code block preservation
- Table formatting with column alignment
- Prose wrapping (
always,never,preserve) - Definition list support
- Front matter preservation
- Setext to ATX heading conversion
- Deep nesting support
YAML Formatting
- Consistent, configurable indentation (default 2 spaces)
- Map and list formatting
- Nested structure support
- Automatic string quoting for special values
- Comment preservation (inline and block)
CLI
- Format files in place (
-o write) - Preview output (
-o show) - JSON output (
-o json) - CI check mode (
-o none --set-exit-if-changed) - Recursive directory processing
- Configurable print width and prose wrap
Configuration
dapper.yamlconfiguration file supportanalysis_options.yamlintegration- CLI arguments override file configuration