Add trailing commas to some parameter lists to get better formatting (#420)

diff --git a/bin/markdown.dart b/bin/markdown.dart
index f3b4ad3..76926c6 100644
--- a/bin/markdown.dart
+++ b/bin/markdown.dart
@@ -19,16 +19,18 @@
   final parser = ArgParser()
     ..addFlag('help', negatable: false, help: 'Print help text and exit')
     ..addFlag('version', negatable: false, help: 'Print version and exit')
-    ..addOption('extension-set',
-        allowed: ['none', 'CommonMark', 'GitHubFlavored', 'GitHubWeb'],
-        defaultsTo: 'CommonMark',
-        help: 'Specify a set of extensions',
-        allowedHelp: {
-          'none': 'No extensions; similar to Markdown.pl',
-          'CommonMark': 'Parse like CommonMark Markdown (default)',
-          'GitHubFlavored': 'Parse like GitHub Flavored Markdown',
-          'GitHubWeb': 'Parse like GitHub\'s Markdown-enabled web input fields',
-        });
+    ..addOption(
+      'extension-set',
+      allowed: ['none', 'CommonMark', 'GitHubFlavored', 'GitHubWeb'],
+      defaultsTo: 'CommonMark',
+      help: 'Specify a set of extensions',
+      allowedHelp: {
+        'none': 'No extensions; similar to Markdown.pl',
+        'CommonMark': 'Parse like CommonMark Markdown (default)',
+        'GitHubFlavored': 'Parse like GitHub Flavored Markdown',
+        'GitHubWeb': 'Parse like GitHub\'s Markdown-enabled web input fields',
+      },
+    );
   final results = parser.parse(args);
 
   if (results['help'] as bool) {
diff --git a/example/app.dart b/example/app.dart
index 78da8a3..0b06b6b 100644
--- a/example/app.dart
+++ b/example/app.dart
@@ -62,8 +62,10 @@
 void _renderMarkdown([Event? event]) {
   final markdown = markdownInput.value!;
 
-  htmlDiv.setInnerHtml(md.markdownToHtml(markdown, extensionSet: extensionSet),
-      treeSanitizer: nullSanitizer);
+  htmlDiv.setInnerHtml(
+    md.markdownToHtml(markdown, extensionSet: extensionSet),
+    treeSanitizer: nullSanitizer,
+  );
 
   for (final block in htmlDiv.querySelectorAll('pre code')) {
     try {
diff --git a/lib/src/block_parser.dart b/lib/src/block_parser.dart
index 17a7739..ab05de9 100644
--- a/lib/src/block_parser.dart
+++ b/lib/src/block_parser.dart
@@ -1007,7 +1007,10 @@
   /// [alignments] is used to annotate an alignment on each cell, and
   /// [cellType] is used to declare either "td" or "th" cells.
   Element _parseRow(
-      BlockParser parser, List<String?> alignments, String cellType) {
+    BlockParser parser,
+    List<String?> alignments,
+    String cellType,
+  ) {
     final line = parser.current;
     final cells = <String>[];
     var index = _walkPastOpeningPipe(line);
@@ -1152,7 +1155,9 @@
   /// Extract reference link definitions from the front of the paragraph, and
   /// return the remaining paragraph lines.
   List<String>? _extractReflinkDefinitions(
-      BlockParser parser, List<String> lines) {
+    BlockParser parser,
+    List<String> lines,
+  ) {
     bool lineStartsReflinkDefinition(int i) =>
         lines[i].startsWith(_reflinkDefinitionStart);
 
@@ -1237,13 +1242,14 @@
   // Returns whether [contents] could be parsed as a reference link definition.
   bool _parseReflinkDefinition(BlockParser parser, String contents) {
     final pattern = RegExp(
-        // Leading indentation.
-        '''^[ ]{0,3}'''
-        // Reference id in brackets, and URL.
-        r'''\[((?:\\\]|[^\]])+)\]:\s*(?:<(\S+)>|(\S+))\s*'''
-        // Title in double or single quotes, or parens.
-        r'''("[^"]+"|'[^']+'|\([^)]+\)|)\s*$''',
-        multiLine: true);
+      // Leading indentation.
+      '''^[ ]{0,3}'''
+      // Reference id in brackets, and URL.
+      r'''\[((?:\\\]|[^\]])+)\]:\s*(?:<(\S+)>|(\S+))\s*'''
+      // Title in double or single quotes, or parens.
+      r'''("[^"]+"|'[^']+'|\([^)]+\)|)\s*$''',
+      multiLine: true,
+    );
     final match = pattern.firstMatch(contents);
     if (match == null) {
       // Not a reference link definition.
diff --git a/lib/src/inline_parser.dart b/lib/src/inline_parser.dart
index ac0cc73..d41d050 100644
--- a/lib/src/inline_parser.dart
+++ b/lib/src/inline_parser.dart
@@ -232,14 +232,23 @@
         final openerTextNodeIndex = _tree.indexOf(openerTextNode);
         final closerTextNode = closer.node;
         var closerTextNodeIndex = _tree.indexOf(closerTextNode);
-        final node = opener.syntax.close(this, opener, closer,
-            tag: matchedTag.tag,
-            getChildren: () =>
-                _tree.sublist(openerTextNodeIndex + 1, closerTextNodeIndex));
+        final node = opener.syntax.close(
+          this,
+          opener,
+          closer,
+          tag: matchedTag.tag,
+          getChildren: () => _tree.sublist(
+            openerTextNodeIndex + 1,
+            closerTextNodeIndex,
+          ),
+        );
         // Replace all of the nodes between the opener and the closer (which
         // are now the new emphasis node's children) with the emphasis node.
         _tree.replaceRange(
-            openerTextNodeIndex + 1, closerTextNodeIndex, [node!]);
+          openerTextNodeIndex + 1,
+          closerTextNodeIndex,
+          [node!],
+        );
         // Slide [closerTextNodeIndex] back accordingly.
         closerTextNodeIndex = openerTextNodeIndex + 2;
 
@@ -483,8 +492,10 @@
 /// Markdown benchmarking is more mature.
 class InlineHtmlSyntax extends TextSyntax {
   InlineHtmlSyntax()
-      : super(r'<[/!?]?[A-Za-z][A-Za-z0-9-]*(?:\s[^>]*)?>',
-            startCharacter: $lt);
+      : super(
+          r'<[/!?]?[A-Za-z][A-Za-z0-9-]*(?:\s[^>]*)?>',
+          startCharacter: $lt,
+        );
 }
 
 /// Matches autolinks like `<foo@bar.example.com>`.
@@ -716,15 +727,15 @@
 
   final int endPos;
 
-  SimpleDelimiter(
-      {required this.node,
-      required this.char,
-      required this.length,
-      required this.canOpen,
-      required this.canClose,
-      required this.syntax,
-      required this.endPos})
-      : isActive = true;
+  SimpleDelimiter({
+    required this.node,
+    required this.char,
+    required this.length,
+    required this.canOpen,
+    required this.canClose,
+    required this.syntax,
+    required this.endPos,
+  }) : isActive = true;
 }
 
 /// An implementation of [Delimiter] which uses concepts of "left-flanking" and
@@ -811,11 +822,15 @@
 
   /// Tries to parse a delimiter run from [runStart] (inclusive) to [runEnd]
   /// (exclusive).
-  static DelimiterRun? tryParse(InlineParser parser, int runStart, int runEnd,
-      {required DelimiterSyntax syntax,
-      required List<DelimiterTag> tags,
-      required Text node,
-      bool allowIntraWord = false}) {
+  static DelimiterRun? tryParse(
+    InlineParser parser,
+    int runStart,
+    int runEnd, {
+    required DelimiterSyntax syntax,
+    required List<DelimiterTag> tags,
+    required Text node,
+    bool allowIntraWord = false,
+  }) {
     bool leftFlanking,
         rightFlanking,
         precededByPunctuation,
@@ -911,12 +926,13 @@
   /// is passed, this syntax parses according to the same nesting rules as
   /// emphasis delimiters.  If [startCharacter] is passed, it is used as a
   /// pre-matching check which is faster than matching against [pattern].
-  DelimiterSyntax(String pattern,
-      {this.requiresDelimiterRun = false,
-      int? startCharacter,
-      this.allowIntraWord = false,
-      this.tags})
-      : super(pattern, startCharacter: startCharacter);
+  DelimiterSyntax(
+    String pattern, {
+    this.requiresDelimiterRun = false,
+    int? startCharacter,
+    this.allowIntraWord = false,
+    this.tags,
+  }) : super(pattern, startCharacter: startCharacter);
 
   @override
   bool onMatch(InlineParser parser, Match match) {
@@ -926,22 +942,27 @@
     final text = Text(parser.source.substring(matchStart, matchEnd));
     if (!requiresDelimiterRun) {
       parser._pushDelimiter(SimpleDelimiter(
-          node: text,
-          length: runLength,
-          char: parser.source.codeUnitAt(matchStart),
-          canOpen: true,
-          canClose: false,
-          syntax: this,
-          endPos: matchEnd));
+        node: text,
+        length: runLength,
+        char: parser.source.codeUnitAt(matchStart),
+        canOpen: true,
+        canClose: false,
+        syntax: this,
+        endPos: matchEnd,
+      ));
       parser.addNode(text);
       return true;
     }
 
-    final delimiterRun = DelimiterRun.tryParse(parser, matchStart, matchEnd,
-        syntax: this,
-        node: text,
-        allowIntraWord: allowIntraWord,
-        tags: tags ?? []);
+    final delimiterRun = DelimiterRun.tryParse(
+      parser,
+      matchStart,
+      matchEnd,
+      syntax: this,
+      node: text,
+      allowIntraWord: allowIntraWord,
+      tags: tags ?? [],
+    );
     if (delimiterRun != null) {
       parser._pushDelimiter(delimiterRun);
       parser.addNode(text);
@@ -979,8 +1000,12 @@
 
   /// Parses `**strong**` and `*emphasis*`.
   EmphasisSyntax.asterisk()
-      : super(r'\*+',
-            requiresDelimiterRun: true, allowIntraWord: true, tags: _tags);
+      : super(
+          r'\*+',
+          requiresDelimiterRun: true,
+          allowIntraWord: true,
+          tags: _tags,
+        );
 
   static final _tags = [DelimiterTag('em', 1), DelimiterTag('strong', 2)];
 }
@@ -988,10 +1013,12 @@
 /// Matches strikethrough syntax according to the GFM spec.
 class StrikethroughSyntax extends DelimiterSyntax {
   StrikethroughSyntax()
-      : super('~+',
-            requiresDelimiterRun: true,
-            allowIntraWord: true,
-            tags: [DelimiterTag('del', 2)]);
+      : super(
+          '~+',
+          requiresDelimiterRun: true,
+          allowIntraWord: true,
+          tags: [DelimiterTag('del', 2)],
+        );
 }
 
 @Deprecated('Use DelimiterSyntax instead')
@@ -1006,11 +1033,11 @@
 
   final Resolver linkResolver;
 
-  LinkSyntax(
-      {Resolver? linkResolver,
-      String pattern = r'\[',
-      int startCharacter = $lbracket})
-      : linkResolver = (linkResolver ?? ((String _, [String? __]) => null)),
+  LinkSyntax({
+    Resolver? linkResolver,
+    String pattern = r'\[',
+    int startCharacter = $lbracket,
+  })  : linkResolver = (linkResolver ?? ((String _, [String? __]) => null)),
         super(pattern, startCharacter: startCharacter);
 
   @override
@@ -1041,8 +1068,11 @@
       final leftParenIndex = parser.pos;
       final inlineLink = _parseInlineLink(parser);
       if (inlineLink != null) {
-        return _tryCreateInlineLink(parser, inlineLink,
-            getChildren: getChildren);
+        return _tryCreateInlineLink(
+          parser,
+          inlineLink,
+          getChildren: getChildren,
+        );
       }
       // At this point, we've matched `[...](`, but that `(` did not pan out to
       // be an inline link. We must now check if `[...]` is simply a shortcut
@@ -1088,12 +1118,17 @@
   ///
   /// [label] does not need to be normalized.
   Node? _resolveReferenceLink(
-      String label, Map<String, LinkReference> linkReferences,
-      {required List<Node> Function() getChildren}) {
+    String label,
+    Map<String, LinkReference> linkReferences, {
+    required List<Node> Function() getChildren,
+  }) {
     final linkReference = linkReferences[normalizeLinkLabel(label)];
     if (linkReference != null) {
-      return _createNode(linkReference.destination, linkReference.title,
-          getChildren: getChildren);
+      return _createNode(
+        linkReference.destination,
+        linkReference.title,
+        getChildren: getChildren,
+      );
     } else {
       // This link has no reference definition. But we allow users of the
       // library to specify a custom resolver function ([linkResolver]) that
@@ -1115,8 +1150,11 @@
   }
 
   /// Create the node represented by a Markdown link.
-  Node _createNode(String destination, String? title,
-      {required List<Node> Function() getChildren}) {
+  Node _createNode(
+    String destination,
+    String? title, {
+    required List<Node> Function() getChildren,
+  }) {
     final children = getChildren();
     final element = Element('a', children);
     element.attributes['href'] = escapeAttribute(destination);
@@ -1129,17 +1167,26 @@
   /// Tries to create a reference link node.
   ///
   /// Returns the link if it was successfully created, `null` otherwise.
-  Node? _tryCreateReferenceLink(InlineParser parser, String label,
-      {required List<Node> Function() getChildren}) {
-    return _resolveReferenceLink(label, parser.document.linkReferences,
-        getChildren: getChildren);
+  Node? _tryCreateReferenceLink(
+    InlineParser parser,
+    String label, {
+    required List<Node> Function() getChildren,
+  }) {
+    return _resolveReferenceLink(
+      label,
+      parser.document.linkReferences,
+      getChildren: getChildren,
+    );
   }
 
   // Tries to create an inline link node.
   //
   /// Returns the link if it was successfully created, `null` otherwise.
-  Node _tryCreateInlineLink(InlineParser parser, InlineLink link,
-      {required List<Node> Function() getChildren}) {
+  Node _tryCreateInlineLink(
+    InlineParser parser,
+    InlineLink link, {
+    required List<Node> Function() getChildren,
+  }) {
     return _createNode(link.destination, link.title, getChildren: getChildren);
   }
 
@@ -1413,13 +1460,17 @@
 class ImageSyntax extends LinkSyntax {
   ImageSyntax({Resolver? linkResolver})
       : super(
-            linkResolver: linkResolver,
-            pattern: r'!\[',
-            startCharacter: $exclamation);
+          linkResolver: linkResolver,
+          pattern: r'!\[',
+          startCharacter: $exclamation,
+        );
 
   @override
-  Element _createNode(String destination, String? title,
-      {required List<Node> Function() getChildren}) {
+  Element _createNode(
+    String destination,
+    String? title, {
+    required List<Node> Function() getChildren,
+  }) {
     final element = Element.empty('img');
     final children = getChildren();
     element.attributes['src'] = destination;
diff --git a/test/document_test.dart b/test/document_test.dart
index cac1bed..8a26900 100644
--- a/test/document_test.dart
+++ b/test/document_test.dart
@@ -14,9 +14,9 @@
       final result = document.parseInline('< &');
       expect(result, hasLength(1));
       expect(
-          result[0],
-          const TypeMatcher<Text>()
-              .having((e) => e.text, 'text', equals('< &')));
+        result[0],
+        const TypeMatcher<Text>().having((e) => e.text, 'text', equals('< &')),
+      );
     });
 
     group('with encodeHtml enabled', () {
@@ -26,24 +26,30 @@
         final result =
             document.parseInline('``<p>Hello <em>Markdown</em></p>``');
         final codeSnippet = result.single as Element;
-        expect(codeSnippet.textContent,
-            equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;'));
+        expect(
+          codeSnippet.textContent,
+          equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;'),
+        );
       });
 
       test('encodes HTML in a fenced code block', () {
         final lines = '```\n<p>Hello <em>Markdown</em></p>\n```\n'.split('\n');
         final result = document.parseLines(lines);
         final codeBlock = result.single as Element;
-        expect(codeBlock.textContent,
-            equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;\n'));
+        expect(
+          codeBlock.textContent,
+          equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;\n'),
+        );
       });
 
       test('encodes HTML in an indented code block', () {
         final lines = '    <p>Hello <em>Markdown</em></p>\n'.split('\n');
         final result = document.parseLines(lines);
         final codeBlock = result.single as Element;
-        expect(codeBlock.textContent,
-            equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;\n'));
+        expect(
+          codeBlock.textContent,
+          equals('&lt;p&gt;Hello &lt;em&gt;Markdown&lt;/em&gt;&lt;/p&gt;\n'),
+        );
       });
 
       test('encodeHtml spaces are preserved in text', () {
@@ -63,12 +69,13 @@
         final nodes = document.parseInline(contents);
         expect(nodes, hasLength(1));
         expect(
-            nodes.single,
-            const TypeMatcher<Text>().having(
-              (e) => e.text,
-              'text',
-              '&gt;&quot;&lt; Hello',
-            ));
+          nodes.single,
+          const TypeMatcher<Text>().having(
+            (e) => e.text,
+            'text',
+            '&gt;&quot;&lt; Hello',
+          ),
+        );
       });
     });
 
@@ -80,7 +87,9 @@
             document.parseInline('```<p>Hello <em>Markdown</em></p>```');
         final codeSnippet = result.single as Element;
         expect(
-            codeSnippet.textContent, equals('<p>Hello <em>Markdown</em></p>'));
+          codeSnippet.textContent,
+          equals('<p>Hello <em>Markdown</em></p>'),
+        );
       });
 
       test('leaves HTML alone, in a fenced code block', () {
@@ -88,7 +97,9 @@
         final result = document.parseLines(lines);
         final codeBlock = result.single as Element;
         expect(
-            codeBlock.textContent, equals('<p>Hello <em>Markdown</em></p>\n'));
+          codeBlock.textContent,
+          equals('<p>Hello <em>Markdown</em></p>\n'),
+        );
       });
 
       test('leaves HTML alone, in an indented code block', () {
@@ -96,7 +107,9 @@
         final result = document.parseLines(lines);
         final codeBlock = result.single as Element;
         expect(
-            codeBlock.textContent, equals('<p>Hello <em>Markdown</em></p>\n'));
+          codeBlock.textContent,
+          equals('<p>Hello <em>Markdown</em></p>\n'),
+        );
       });
 
       test('leave double quotes, greater than, and less than when escaped', () {
@@ -105,12 +118,9 @@
         final nodes = document.parseInline(contents);
         expect(nodes, hasLength(1));
         expect(
-            nodes.single,
-            const TypeMatcher<Text>().having(
-              (e) => e.text,
-              'text',
-              '>"< Hello',
-            ));
+          nodes.single,
+          const TypeMatcher<Text>().having((e) => e.text, 'text', '>"< Hello'),
+        );
       });
     });
   });
diff --git a/test/markdown_test.dart b/test/markdown_test.dart
index 827a696..a9f6fde 100644
--- a/test/markdown_test.dart
+++ b/test/markdown_test.dart
@@ -11,21 +11,40 @@
   await testDirectory('original');
 
   // Block syntax extensions
-  testFile('extensions/fenced_code_blocks.unit',
-      blockSyntaxes: [const FencedCodeBlockSyntax()]);
-  testFile('extensions/headers_with_ids.unit',
-      blockSyntaxes: [const HeaderWithIdSyntax()]);
-  testFile('extensions/setext_headers_with_ids.unit',
-      blockSyntaxes: [const SetextHeaderWithIdSyntax()]);
-  testFile('extensions/tables.unit', blockSyntaxes: [const TableSyntax()]);
-  testFile('extensions/fenced_blockquotes.unit',
-      blockSyntaxes: [const FencedBlockquoteSyntax()]);
+  testFile(
+    'extensions/fenced_code_blocks.unit',
+    blockSyntaxes: [const FencedCodeBlockSyntax()],
+  );
+  testFile(
+    'extensions/headers_with_ids.unit',
+    blockSyntaxes: [const HeaderWithIdSyntax()],
+  );
+  testFile(
+    'extensions/setext_headers_with_ids.unit',
+    blockSyntaxes: [const SetextHeaderWithIdSyntax()],
+  );
+  testFile(
+    'extensions/tables.unit',
+    blockSyntaxes: [const TableSyntax()],
+  );
+  testFile(
+    'extensions/fenced_blockquotes.unit',
+    blockSyntaxes: [const FencedBlockquoteSyntax()],
+  );
 
   // Inline syntax extensions
-  testFile('extensions/emojis.unit', inlineSyntaxes: [EmojiSyntax()]);
-  testFile('extensions/inline_html.unit', inlineSyntaxes: [InlineHtmlSyntax()]);
-  testFile('extensions/strikethrough.unit',
-      inlineSyntaxes: [StrikethroughSyntax()]);
+  testFile(
+    'extensions/emojis.unit',
+    inlineSyntaxes: [EmojiSyntax()],
+  );
+  testFile(
+    'extensions/inline_html.unit',
+    inlineSyntaxes: [InlineHtmlSyntax()],
+  );
+  testFile(
+    'extensions/strikethrough.unit',
+    inlineSyntaxes: [StrikethroughSyntax()],
+  );
 
   await testDirectory('common_mark');
   await testDirectory('gfm', extensionSet: ExtensionSet.gitHubFlavored);
@@ -125,10 +144,15 @@
 ''',
         inlineSyntaxes: nyanSyntax);
 
-    validateCore('dart custom links', 'links [are<foo>] awesome',
-        '<p>links <a>are&lt;foo></a> awesome</p>\n',
-        linkResolver: (String text, [String? _]) =>
-            Element.text('a', text.replaceAll('<', '&lt;')));
+    validateCore(
+      'dart custom links',
+      'links [are<foo>] awesome',
+      '<p>links <a>are&lt;foo></a> awesome</p>\n',
+      linkResolver: (String text, [String? _]) => Element.text(
+        'a',
+        text.replaceAll('<', '&lt;'),
+      ),
+    );
 
     // TODO(amouravski): need more tests here for custom syntaxes, as some
     // things are not quite working properly. The regexps are sometime a little
diff --git a/test/util.dart b/test/util.dart
index 354a02b..ad73c0c 100644
--- a/test/util.dart
+++ b/test/util.dart
@@ -24,10 +24,11 @@
   }
 }
 
-Future<String> get markdownPackageRoot async =>
-    p.dirname(p.dirname((await Isolate.resolvePackageUri(
-            Uri.parse('package:markdown/markdown.dart')))!
-        .toFilePath()));
+Future<String> get markdownPackageRoot async {
+  final packageUri = Uri.parse('package:markdown/markdown.dart');
+  final isolateUri = await Isolate.resolvePackageUri(packageUri);
+  return p.dirname(p.dirname(isolateUri!.toFilePath()));
+}
 
 void testFile(
   String file, {
@@ -38,8 +39,13 @@
   for (final dataCase in dataCasesInFile(path: p.join(directory, file))) {
     final description =
         '${dataCase.directory}/${dataCase.file}.unit ${dataCase.description}';
-    validateCore(description, dataCase.input, dataCase.expectedOutput,
-        blockSyntaxes: blockSyntaxes, inlineSyntaxes: inlineSyntaxes);
+    validateCore(
+      description,
+      dataCase.input,
+      dataCase.expectedOutput,
+      blockSyntaxes: blockSyntaxes,
+      inlineSyntaxes: inlineSyntaxes,
+    );
   }
 }
 
@@ -55,13 +61,15 @@
   bool inlineOnly = false,
 }) {
   test(description, () {
-    final result = markdownToHtml(markdown,
-        blockSyntaxes: blockSyntaxes,
-        inlineSyntaxes: inlineSyntaxes,
-        extensionSet: extensionSet,
-        linkResolver: linkResolver,
-        imageLinkResolver: imageLinkResolver,
-        inlineOnly: inlineOnly);
+    final result = markdownToHtml(
+      markdown,
+      blockSyntaxes: blockSyntaxes,
+      inlineSyntaxes: inlineSyntaxes,
+      extensionSet: extensionSet,
+      linkResolver: linkResolver,
+      imageLinkResolver: imageLinkResolver,
+      inlineOnly: inlineOnly,
+    );
 
     markdownPrintOnFailure(markdown, html, result);
 
diff --git a/test/version_test.dart b/test/version_test.dart
index 4c200fe..14763d3 100644
--- a/test/version_test.dart
+++ b/test/version_test.dart
@@ -16,10 +16,13 @@
     final binary = p.normalize(p.join(packageRoot, 'bin', 'markdown.dart'));
     final dartBin = Platform.executable;
     final result = Process.runSync(dartBin, [binary, '--version']);
-    expect(result.exitCode, 0,
-        reason: 'Exit code expected: 0; actual: ${result.exitCode}\n\n'
-            'stdout: ${result.stdout}\n\n'
-            'stderr: ${result.stderr}');
+    expect(
+      result.exitCode,
+      0,
+      reason: 'Exit code expected: 0; actual: ${result.exitCode}\n\n'
+          'stdout: ${result.stdout}\n\n'
+          'stderr: ${result.stderr}',
+    );
 
     final binVersion = (result.stdout as String).trim();
 
@@ -28,8 +31,11 @@
     final pubspecContent =
         loadYaml(File(pubspecFile).readAsStringSync()) as YamlMap;
 
-    expect(binVersion, pubspecContent['version'],
-        reason: 'The version reported by bin/markdown.dart should match the '
-            'version in pubspec. Run `pub run build_runner build` to update.');
+    expect(
+      binVersion,
+      pubspecContent['version'],
+      reason: 'The version reported by bin/markdown.dart should match the '
+          'version in pubspec. Run `pub run build_runner build` to update.',
+    );
   });
 }
diff --git a/tool/dartdoc_compare.dart b/tool/dartdoc_compare.dart
index cd0c4fc..e0195ba 100644
--- a/tool/dartdoc_compare.dart
+++ b/tool/dartdoc_compare.dart
@@ -20,10 +20,17 @@
     ..addSeparator('Usage: dartdoc-compare.dart [OPTIONS] <dart-package>')
     ..addOption(_dartdocDir, help: 'Directory of the dartdoc package')
     ..addOption(_markdownBefore, help: "Markdown package 'before' ref")
-    ..addOption(_markdownAfter,
-        defaultsTo: 'HEAD', help: "Markdown package 'after' ref (or 'local')")
-    ..addFlag(_sdk,
-        defaultsTo: false, negatable: false, help: 'Is the package the SDK?')
+    ..addOption(
+      _markdownAfter,
+      defaultsTo: 'HEAD',
+      help: "Markdown package 'after' ref (or 'local')",
+    )
+    ..addFlag(
+      _sdk,
+      defaultsTo: false,
+      negatable: false,
+      help: 'Is the package the SDK?',
+    )
     ..addFlag(_help, abbr: 'h', hide: true);
 
   final options = parser.parse(arguments);
@@ -40,12 +47,13 @@
     return;
   }
   final comparer = DartdocCompare(
-      options[_dartdocDir] as String,
-      options[_markdownBefore] as String,
-      options[_markdownAfter] as String,
-      absolute(options[_dartdocDir] as String, 'bin/dartdoc.dart'),
-      absolute(options[_dartdocDir] as String, 'pubspec.yaml'),
-      options[_sdk] as bool);
+    options[_dartdocDir] as String,
+    options[_markdownBefore] as String,
+    options[_markdownAfter] as String,
+    absolute(options[_dartdocDir] as String, 'bin/dartdoc.dart'),
+    absolute(options[_dartdocDir] as String, 'pubspec.yaml'),
+    options[_sdk] as bool,
+  );
 
   String? path;
   if (comparer.sdk) {
@@ -72,8 +80,14 @@
   final bool sdk;
   final String markdownPath = File(Platform.script.path).parent.parent.path;
 
-  DartdocCompare(this.dartdocDir, this.markdownBefore, this.markdownAfter,
-      this.dartdocBin, this.dartdocPubspecPath, this.sdk);
+  DartdocCompare(
+    this.dartdocDir,
+    this.markdownBefore,
+    this.markdownAfter,
+    this.dartdocBin,
+    this.dartdocPubspecPath,
+    this.sdk,
+  );
 
   bool compare(String? package) {
     // Generate docs with Markdown "Before".
diff --git a/tool/expected_output.dart b/tool/expected_output.dart
index 81d63e6..30d8fe9 100644
--- a/tool/expected_output.dart
+++ b/tool/expected_output.dart
@@ -8,8 +8,10 @@
 import 'package:path/path.dart' as p;
 
 /// Parse and yield data cases (each a [DataCase]) from [path].
-Iterable<DataCase> dataCasesInFile(
-    {required String path, String? baseDir}) sync* {
+Iterable<DataCase> dataCasesInFile({
+  required String path,
+  String? baseDir,
+}) sync* {
   final file = p.basename(path).replaceFirst(RegExp(r'\..+$'), '');
   baseDir ??= p.relative(p.dirname(path), from: p.dirname(p.dirname(path)));
 
@@ -44,13 +46,14 @@
     }
 
     final dataCase = DataCase(
-        directory: baseDir,
-        file: file,
-        front_matter: frontMatter.toString(),
-        description: description,
-        skip: skip,
-        input: input,
-        expectedOutput: expectedOutput);
+      directory: baseDir,
+      file: file,
+      front_matter: frontMatter.toString(),
+      description: description,
+      skip: skip,
+      input: input,
+      expectedOutput: expectedOutput,
+    );
     yield dataCase;
   }
 }
@@ -118,13 +121,16 @@
   String extension = 'unit',
   bool recursive = true,
 }) async* {
-  final markdownLibRoot = p.dirname((await Isolate.resolvePackageUri(
-          Uri.parse('package:markdown/markdown.dart')))!
-      .toFilePath());
+  final packageUri = Uri.parse('package:markdown/markdown.dart');
+  final isolateUri = await Isolate.resolvePackageUri(packageUri);
+  final markdownLibRoot = p.dirname(isolateUri!.toFilePath());
   final directory =
       p.joinAll([p.dirname(markdownLibRoot), 'test', testDirectory]);
   for (final dataCase in _dataCases(
-      directory: directory, extension: extension, recursive: recursive)) {
+    directory: directory,
+    extension: extension,
+    recursive: recursive,
+  )) {
     yield dataCase;
   }
 }
diff --git a/tool/stats.dart b/tool/stats.dart
index 55f05b8..a212e6c 100644
--- a/tool/stats.dart
+++ b/tool/stats.dart
@@ -14,27 +14,41 @@
 import '../tool/expected_output.dart';
 import 'stats_lib.dart';
 
-final _configs =
-    List<Config>.unmodifiable([Config.commonMarkConfig, Config.gfmConfig]);
+final _configs = List<Config>.unmodifiable([
+  Config.commonMarkConfig,
+  Config.gfmConfig,
+]);
 
 Future<void> main(List<String> args) async {
   final parser = ArgParser()
-    ..addOption('section',
-        help: 'Restrict tests to one section, provided after the option.')
-    ..addFlag('raw',
-        defaultsTo: false, help: 'raw JSON format', negatable: false)
-    ..addFlag('update-files',
-        defaultsTo: false,
-        help: 'Update stats files in $toolDir',
-        negatable: false)
-    ..addFlag('verbose',
-        defaultsTo: false,
-        help: 'Print details for failures and errors.',
-        negatable: false)
-    ..addFlag('verbose-loose',
-        defaultsTo: false,
-        help: 'Print details for "loose" matches.',
-        negatable: false)
+    ..addOption(
+      'section',
+      help: 'Restrict tests to one section, provided after the option.',
+    )
+    ..addFlag(
+      'raw',
+      defaultsTo: false,
+      help: 'raw JSON format',
+      negatable: false,
+    )
+    ..addFlag(
+      'update-files',
+      defaultsTo: false,
+      help: 'Update stats files in $toolDir',
+      negatable: false,
+    )
+    ..addFlag(
+      'verbose',
+      defaultsTo: false,
+      help: 'Print details for failures and errors.',
+      negatable: false,
+    )
+    ..addFlag(
+      'verbose-loose',
+      defaultsTo: false,
+      help: 'Print details for "loose" matches.',
+      negatable: false,
+    )
     ..addOption('flavor', allowed: _configs.map((c) => c.prefix))
     ..addFlag('help', defaultsTo: false, negatable: false);
 
@@ -76,8 +90,14 @@
       testPrefix == null ? _configs.map((c) => c.prefix) : <String>[testPrefix];
 
   for (final testPrefix in testPrefixes) {
-    await _processConfig(testPrefix, raw, updateFiles, verbose,
-        specifiedSection, verboseLooseMatch);
+    await _processConfig(
+      testPrefix,
+      raw,
+      updateFiles,
+      verbose,
+      specifiedSection,
+      verboseLooseMatch,
+    );
   }
 }
 
@@ -115,8 +135,12 @@
     final units = <DataCase>[];
 
     for (final e in entry.value) {
-      final result = compareResult(config, e,
-          verboseFail: verbose, verboseLooseMatch: verboseLooseMatch);
+      final result = compareResult(
+        config,
+        e,
+        verboseFail: verbose,
+        verboseLooseMatch: verboseLooseMatch,
+      );
 
       units.add(DataCase(
         front_matter: result.testCase.toString(),
@@ -128,7 +152,9 @@
       ));
 
       final nestedMap = scores.putIfAbsent(
-          entry.key, () => SplayTreeMap<int, CompareLevel>());
+        entry.key,
+        () => SplayTreeMap<int, CompareLevel>(),
+      );
       nestedMap[e.example] = result.compareLevel;
     }
 
@@ -180,8 +206,11 @@
   return obj;
 }
 
-Future<void> _printRaw(String testPrefix,
-    Map<String, Map<int, CompareLevel>> scores, bool updateFiles) async {
+Future<void> _printRaw(
+  String testPrefix,
+  Map<String, Map<int, CompareLevel>> scores,
+  bool updateFiles,
+) async {
   IOSink sink;
   if (updateFiles) {
     final file = getStatsFile(testPrefix);
@@ -210,9 +239,10 @@
     '– ${(100 * value / total).toStringAsFixed(1).padLeft(5)}%  $section';
 
 Future<void> _printFriendly(
-    String testPrefix,
-    SplayTreeMap<String, SplayTreeMap<int, CompareLevel>> scores,
-    bool updateFiles) async {
+  String testPrefix,
+  SplayTreeMap<String, SplayTreeMap<int, CompareLevel>> scores,
+  bool updateFiles,
+) async {
   var totalValid = 0;
   var totalStrict = 0;
   var totalExamples = 0;
diff --git a/tool/stats_lib.dart b/tool/stats_lib.dart
index b0c7a26..125b34e 100644
--- a/tool/stats_lib.dart
+++ b/tool/stats_lib.dart
@@ -15,12 +15,15 @@
 
 // Locate the "tool" directory. Use mirrors so that this works with the test
 // package, which loads this suite into an isolate.
-String get toolDir =>
-    p.dirname((reflect(loadCommonMarkSections) as ClosureMirror)
-        .function
-        .location!
-        .sourceUri
-        .path);
+String get toolDir {
+  final path = (reflect(loadCommonMarkSections) as ClosureMirror)
+      .function
+      .location!
+      .sourceUri
+      .path;
+
+  return p.dirname(path);
+}
 
 File getStatsFile(String prefix) =>
     File(p.join(toolDir, '${prefix}_stats.json'));
@@ -48,10 +51,16 @@
 }
 
 class Config {
-  static final Config commonMarkConfig =
-      Config._('common_mark', 'http://spec.commonmark.org/0.28/', null);
+  static final Config commonMarkConfig = Config._(
+    'common_mark',
+    'http://spec.commonmark.org/0.28/',
+    null,
+  );
   static final Config gfmConfig = Config._(
-      'gfm', 'https://github.github.com/gfm/', ExtensionSet.gitHubFlavored);
+    'gfm',
+    'https://github.github.com/gfm/',
+    ExtensionSet.gitHubFlavored,
+  );
 
   final String prefix;
   final String baseUrl;
@@ -68,17 +77,24 @@
   final int startLine;
   final int endLine;
 
-  CommonMarkTestCase(this.example, this.section, this.startLine, this.endLine,
-      this.markdown, this.html);
+  CommonMarkTestCase(
+    this.example,
+    this.section,
+    this.startLine,
+    this.endLine,
+    this.markdown,
+    this.html,
+  );
 
   factory CommonMarkTestCase.fromJson(Map<String, dynamic> json) {
     return CommonMarkTestCase(
-        json['example'] as int,
-        json['section'] as String /*!*/,
-        json['start_line'] as int,
-        json['end_line'] as int,
-        json['markdown'] as String /*!*/,
-        json['html'] as String);
+      json['example'] as int,
+      json['section'] as String /*!*/,
+      json['start_line'] as int,
+      json['end_line'] as int,
+      json['markdown'] as String /*!*/,
+      json['html'] as String,
+    );
   }
 
   @override
@@ -95,10 +111,13 @@
   CompareResult(this.testCase, this.result, this.compareLevel);
 }
 
-CompareResult compareResult(Config config, CommonMarkTestCase testCase,
-    {bool throwOnError = false,
-    bool verboseFail = false,
-    bool verboseLooseMatch = false}) {
+CompareResult compareResult(
+  Config config,
+  CommonMarkTestCase testCase, {
+  bool throwOnError = false,
+  bool verboseFail = false,
+  bool verboseLooseMatch = false,
+}) {
   String output;
   try {
     output =
@@ -109,7 +128,11 @@
     }
     if (verboseFail) {
       _printVerboseFailure(
-          config.baseUrl, 'ERROR', testCase, 'Thrown: $err\n$stackTrace');
+        config.baseUrl,
+        'ERROR',
+        testCase,
+        'Thrown: $err\n$stackTrace',
+      );
     }
 
     return CompareResult(testCase, null, CompareLevel.error);
@@ -133,14 +156,21 @@
   }
 
   return CompareResult(
-      testCase, output, looseMatch ? CompareLevel.loose : CompareLevel.fail);
+    testCase,
+    output,
+    looseMatch ? CompareLevel.loose : CompareLevel.fail,
+  );
 }
 
 String _indent(String s) =>
     s.splitMapJoin('\n', onNonMatch: (n) => '    ${whitespaceColor(n)}');
 
-void _printVerboseFailure(String baseUrl, String message,
-    CommonMarkTestCase testCase, String actual) {
+void _printVerboseFailure(
+  String baseUrl,
+  String message,
+  CommonMarkTestCase testCase,
+  String actual,
+) {
   print('$message: $baseUrl#example-${testCase.example} '
       '@ ${testCase.section}');
   print('input:');
@@ -154,7 +184,9 @@
 
 /// Compare two DOM trees for equality.
 bool _compareHtml(
-    List<Element> expectedElements, List<Element> actualElements) {
+  List<Element> expectedElements,
+  List<Element> actualElements,
+) {
   if (expectedElements.length != actualElements.length) {
     return false;
   }
diff --git a/tool/update_blns.dart b/tool/update_blns.dart
index 7491470..b48b8a7 100644
--- a/tool/update_blns.dart
+++ b/tool/update_blns.dart
@@ -12,11 +12,9 @@
   try {
     final request = await client.getUrl(Uri.parse(_blnsJsonRawUrl));
     final response = await request.close();
-    json = (jsonDecode(await response
-            .cast<List<int>>()
-            .transform(utf8.decoder)
-            .join('')) as List)
-        .cast<String>();
+    final source =
+        await response.cast<List<int>>().transform(utf8.decoder).join('');
+    json = (jsonDecode(source) as List).cast<String>();
   } finally {
     client.close();
   }