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

Feature request: Support strikethrough #133

Closed
9 of 12 tasks
ZacSweers opened this issue Apr 25, 2024 · 7 comments · Fixed by #138
Closed
9 of 12 tasks

Feature request: Support strikethrough #133

ZacSweers opened this issue Apr 25, 2024 · 7 comments · Fixed by #138

Comments

@ZacSweers
Copy link

About this issue

Currently, strikethrough nodes are omitted from the rendered markdown.

~~This is strikethrough~~

Details

  •  Used library version - 0.14.0
  •  Used platform - Desktop
  •  Used support library version
  •  Used gradle build tools version - N/A
  •  Used tooling / Android Studio version - N/A
  •  Other used libraries, potential conflicting libraries - Jewel

Checklist

@mikepenz
Copy link
Owner

I am afraid this is currently not exposed from the markdown library.

Example for italic text:
Screenshot 2024-04-25 at 20 29 30

In comparison strikethrough text:
Screenshot 2024-04-25 at 20 30 05

It only exposes EMPH or STRONG at this time:

@ZacSweers
Copy link
Author

Interesting, let me file something on their side for this!

@ZacSweers
Copy link
Author

It looks like this is supported as a GFM-specific extension here: https://github.com/JetBrains/markdown/blob/76cec19922613609a5b2ab8110df830c708f7214/src/commonMain/kotlin/org/intellij/markdown/flavours/gfm/GFMElementTypes.kt#L29

Is that something we can configure in this library?

@mikepenz
Copy link
Owner

Thanks, had overlooked this one. Need to check why it is parsed differently than the emph and strong ones.

And yes, any type not handled can be handled via the custom component support: https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/Markdown.kt#L98

@mikepenz
Copy link
Owner

mikepenz commented Apr 25, 2024

Good news. With the ~~text~~ it parses it properly. will include it.

Tested with ~text~ before, which I am usually used to.

@ZacSweers
Copy link
Author

Nice!

@mikepenz
Copy link
Owner

Also a perhaps relevant note as I saw your code snippet for the custom component.

Strikethrough is part of the annotated string: https://github.com/mikepenz/multiplatform-markdown-renderer/blob/ef34d93c2bf8dbfb0488b0db65357c339d72b6b2/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/utils/AnnotatedStringKtx.kt
Which would require the Paragraph component to be overwritten and then it's internal parsing. I didn't consider this in the prior message. Given that, it would probably be quite more effort than a simple top level component.
Already exposed most classes to make that simpler, but it would still be quite a lift.

It might be a great addition to the library to also allow expanding the buildMarkdownAnnotatedString with custom conditions, so it is simpler to adjust this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants