Skip to content

Github single tilde strikethrough #1351

Closed
dart-archive/markdown
#595
@robertoestivill

Description

@robertoestivill

I'm using this library through flutter_markdown and I'm having issues supporting single tilde ~ strikethrough.

From the Github Flavored Markdown specification I can see that single tilde should also produce strike through text.

Screenshot 2024-03-05 at 10 23 09
My reproducible example
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    const markdown = '~~this works~~ \n\n~this doesnt work~';

    print(
      md.markdownToHtml(
        markdown,
        extensionSet: md.ExtensionSet.gitHubFlavored,
      ),
    );

    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: const Text(
            'Markdown bug report\nSingle tildes not working',
          ),
        ),
        body: Markdown(
          data: markdown,
          extensionSet: md.ExtensionSet.gitHubFlavored,
        ),
      ),
    );
  }
}

Generates the following outputs

Screenshot 2024-03-05 at 10 55 37
Screenshot 2024-03-05 at 10 58 22

As you can see in the last console screenshot, the lack of <del> elements in the second line is the problem and the reason why I decided to create the bug in this repository instead of creating it in flutter_markdown.

flutter doctor
➜  bugreport fvm flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.2.1 23C71 darwin-arm64, locale en-DE)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development.
      Download at: https://developer.apple.com/xcode/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.

Any ideas? What am I missing?
Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onpackage:markdowntype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions