Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github single tilde strikethrough #1351

Closed
robertoestivill opened this issue Mar 5, 2024 · 1 comment · Fixed by dart-archive/markdown#595
Closed

Github single tilde strikethrough #1351

robertoestivill opened this issue Mar 5, 2024 · 1 comment · Fixed by dart-archive/markdown#595
Labels
P2 A bug or feature request we're likely to work on package:markdown type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@robertoestivill
Copy link

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

@srawlins
Copy link
Member

srawlins commented Mar 5, 2024

I think it's a bug. Reproduces at https://dart-lang.github.io/markdown/

And it appears we have only have unit tests for ~~. But the pattern that we use for StrikethroughSyntax is '~+' which should support single tildes. Not sure what's going on.

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P2 A bug or feature request we're likely to work on labels Mar 5, 2024
@mosuem mosuem transferred this issue from dart-archive/markdown Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on package:markdown type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants