Repository: flutter
Issue: [flutter_markdown] bug/strange behavior with custom MarkdownElementBuilder for links ('a' tag)
Labels: package,team-ecosystem,has reproducible steps,P3,p: flutter_markdown,triaged-ecosystem,found in release: 3.13,found in release: 3.16

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. create MarkdownElementBuilder
2. use it in MarkdownBody with the tag 'a'
3. write a link as markdown data that has a link with the text part of it consisting of more than two words

  flutter_markdown: ^0.6.18
  markdown: ^7.1.1

### Expected results

The MarkdownElementBuilder should work for the whole element with the tag and not show the rest of the link text

### Actual results

the first word of the text part of the link is replaced by the widget in MarkdownElementBuilder and the rest are shown as regular

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:markdown/markdown.dart' as md;
import 'package:flutter_markdown/flutter_markdown.dart' as md;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(useMaterial3: true),
      home: const MyHomePage(title: 'Markdown bug'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({
    super.key,
    required this.title,
  });

  final String title;

  static const markdownValue = '[this is a test link](https://google.com)';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Text('Markdown with builder'),
            md.MarkdownBody(
              data: markdownValue,
              builders: {
                'a': LinkBuilder(),
              },
            ),
            const SizedBox(height: 16),
            const Text('Markdown without builder'),
            const md.MarkdownBody(data: markdownValue)
          ],
        ),
      ),
    );
  }
}

class LinkBuilder extends md.MarkdownElementBuilder {
  LinkBuilder();

  @override
  Widget visitElementAfterWithContext(
    BuildContext context,
    md.Element element,
    TextStyle? preferredStyle,
    TextStyle? parentStyle,
  ) {
    return Container(
      width: 20,
      height: 20,
      color: Colors.red,
    );
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![Simulator Screenshot - iPhone 14 Pro - 2023-11-01 at 16 15 53](https://github.com/flutter/flutter/assets/29163975/569293f6-1b35-41b4-830a-e3010d24fe13)


</details>


### Logs

<details><summary>Logs</summary>

```console
Launching lib/main.dart on iPhone 14 Pro in debug mode...
Xcode build done.                                            7.3s
[VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend.
Connecting to VM Service at ws://127.0.0.1:54466/5uzhk7Zluug=/ws
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.6.1 22G313 darwin-arm64, locale en-AM)
    • Flutter version 3.13.9 on channel stable at /Users/aram/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (7 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/aram/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.83.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.74.0

[✓] Connected device (4 available)
    • iPhone 14 Pro (mobile) • AA55DA63-C3BF-4848-90DD-34C749483247     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                    • darwin-arm64   • macOS 13.6.1 22G313 darwin-arm64
    • Chrome (web)           • chrome                                   • web-javascript • Google Chrome 118.0.5993.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>