dapper 1.5.0 copy "dapper: ^1.5.0" to clipboard
dapper: ^1.5.0 copied to clipboard

A simple Markdown and YAML formatter for Dart, inspired by Prettier.

1.5.0 #

Fixed #

  • Fix MarkdownPrinter corrupting 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 nested a element 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 bare a@b.com non-idempotent, since their first-pass output [a@b.com](mailto:a@b.com) was corrupted on the next pass. _renderInlineNode now renders an a nested inside a link's label as plain text instead of re-wrapping it.

Changed #

  • Raise the glob constraint 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 **/build now match build and foo/**/bar now matches foo/bar, aligning IgnorePattern with git's own gitignore semantics.
  • Restore the whitespace-only line inside the code block of the handles nested list code block with blank lines test input, which had been replaced by an empty line, and spell the input out with explicit \n escapes 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 bare a@b.com email autolinks.

1.4.8 #

Changed #

  • Remove duplicated inline-print methods (_printInlineCode, _printEmphasis, _printStrong, _printLink, _printImage) in ast_printer.dart and collapse the matching _printElement cases (code / em / strong / a / img) into a single arm that shares _renderInlineNode's output.
  • Extract _renderLinkLike helper in ast_printer.dart so the 'a' and 'img' cases of _renderInlineNode share the title-vs-no-title spelling instead of duplicating the three-line ternary.
  • Decompose _printMap in yaml_formatter.dart into _positionMapKey, _isInlineMapValue, and _writeMapValue so the previously nested key-positioning conditional reads as three named cases and value emission lives in a single helper.
  • Extract _writeGapComment helper in yaml_formatter.dart to separate per-line comment formatting (inline-with-previous vs. indent-rounded standalone) from the gap-line iteration in _printGap.
  • Extract _tryParseDefinitionListAt in definition_list.dart so parseDocumentSegments orchestrates segment dispatch while definition-list parsing lives in a single-responsibility helper.

1.4.7 #

Fixed #

  • Fix parseDocumentSegments allowing 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 _collectDefinitions helper in definition_list.dart to consolidate the two near-duplicate definition-collection loops in parseDocumentSegments.
  • Extract _writeWrappedListItemLine helper in ast_printer.dart so the inline-only and block-mixed paths of _printListItemContent share a single prose-wrap output policy.
  • Split _printTable in ast_printer.dart into _collectTableRows, _collectTableRowCells, _computeColumnWidths, and _writeTableSeparator so the top-level body reads as a collect / measure / print pipeline.
  • Introduce _atLineStart and _endsWithSpace getters in _YamlPrinter to name the recurring buffer-state checks that previously appeared inline as _buffer.toString().endsWith(...).

Added #

  • Add stronger edge-case tests for parseDocumentSegments that verify the collected terms and definitions (including blank lines between definitions of later terms), replacing the prior length >= 1 smoke checks.

1.4.6 #

Fixed #

  • Fix _parseOptionsMap hardcoding default values instead of using FormatOptions.defaults.copyWith().
  • Fix num variable shadowing built-in num type in ordered list formatting.
  • Fix stdout leaking into test output from run_test.dart.

Changed #

  • Cache RegExp objects at module level in text_utils.dart and yaml_formatter.dart to avoid recompilation per call.
  • Use Set literal instead of List for inline tag lookup in _isInline and YAML reserved word check in _needsQuoting.
  • Simplify dart:io imports in dapper_cli.dart from two overlapping imports to a single hide clause.
  • Simplify _resolveOptions to use FormatOptions.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 Set for _needsQuoting.
  • Hide internal basename function from public API via show clause on lib/bin.dart export.
  • Clean up development comments and normalize code style (var for type-inferred locals).
  • Add library; declarations and doc comments to all lib/bin/ files for consistency.
  • Add description line to yaml_formatter.dart library doc comment.
  • Add doc comments to ExitCode, OutputMode, and ProcessResult enum values.

Added #

  • Add countTrailingNewlines to shared text_utils.dart, replacing duplicated implementations in markdown and YAML formatters.
  • Add ulStyle to Option Applicability table in options.dart doc comment.
  • Add file_system.dart to AGENTS.md architecture diagram.
  • Add tests for ConfigLoader: non-existent directory, camelCase options, ul_style shorthands, invalid config, missing dapper block, string integer parsing.
  • Add tests for FormatOptions: ulStyle defaults, copyWith(ulStyle:), UnorderedListStyle enum, toString with ulStyle.
  • Add tests for countTrailingNewlines in text_utils_test.dart.

1.4.5 #

Fixed #

  • Fix inline images losing title attribute when rendered inside paragraphs or list items (e.g., ![alt](src "title")).
  • 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 title attribute 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 with exitCode setter.
    • Added top-level error handling.
    • Extracted execution logic to dapper.run() in lib/bin/dapper_cli.dart.

1.4.3 #

Fixed #

  • Fix broken indentation and layout when formatting loose lists (lists with blank lines).

1.4.2 #

Fixed #

  • Preserve blank lines after HTML comments in Markdown formatting

1.4.1 #

Fixed #

  • Fix space accumulation on blank lines in nested code blocks.

Added #

  • Added strict-casts, strict-inference, and strict-raw-types to analysis_options.yaml for 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_imports to 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 Future and Iterable in tests to satisfy strict mode.

1.4.0 #

Changed #

  • Internal: Remove dead code in Markdown printer related to checkbox list items.
  • Internal: Remove duplicate _ensureTrailingNewline in YAML formatter, reuse text_utils.dart.
  • Internal: Clean up development notes and verbose comments in code.
  • Internal: Move CLI modules from bin/src/ to lib/bin/ for coverage and reusability.
  • Internal: Split test/cli_test.dart into test/bin/ for better organization.

Added #

  • Add FileSystem abstraction in lib/bin/ for testability (100% coverage).
  • Add lib/bin.dart exporting CLI utilities (DapperCli, ConfigLoader, IgnoreRules).
  • Add AGENTS.md for 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 #

Changed #

  • Ignored *-lock.yaml files by default to prevent formatting auto-generated files.

Fixed #

  • Fixed incorrect escaping of backslashes and quotes in double-quoted and single-quoted YAML strings.

1.3.5 #

Fixed #

  • Fixed an issue where Markdown headers stripped inline formatting (e.g. "## code").

1.3.4 #

Fixed #

  • Fix YAML block scalars (| and >) being converted to double-quoted strings (e.g., in GitHub Actions workflows)

1.3.3 #

Fixed #

  • Fix path-based ignore patterns (e.g., ios/Pods, sub/ignored) not working in nested directories

Added #

  • Add comprehensive CLI tests for ignore pattern handling

1.3.2 #

Fixed #

  • Fix .gitignore directory patterns (trailing /) not being recognized

Changed #

  • Refactor CLI code structure for better maintainability

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 .dapperignore and .gitignore support 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)

1.1.1 #

Fixed #

  • Fix extra blank lines being inserted between nested list items

1.1.0 #

Fixed #

  • Add missing executables section to enable dart pub global activate dapper to work correctly
  • Add .pubignore to reduce package size

1.0.4 #

Changed #

  • Remove unused code

1.0.3 #

Added #

  • Add interactive demo page with GitHub Pages support

1.0.2 #

Fixed #

  • Fix bug where nested list items were rendered on the same line instead of new lines

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.yaml configuration file support
  • analysis_options.yaml integration
  • CLI arguments override file configuration
0
likes
160
points
2.49k
downloads

Documentation

API reference

Publisher

verified publisherkoji-1009.com

Weekly Downloads

A simple Markdown and YAML formatter for Dart, inspired by Prettier.

Repository (GitHub)
View/report issues

Topics

#formatter #markdown #yaml #cli

License

MIT (license)

Dependencies

args, glob, markdown, yaml

More

Packages that depend on dapper