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

RichTextStateMarkdownParser.decode doesnt decode Lists or Highlighted text. #223

Open
IsrarShamim opened this issue Mar 30, 2024 · 5 comments

Comments

@IsrarShamim
Copy link

When I use the richTextState.toMarkdown() which supposedly decodes the RichTextState to a markdown string and returns String.
It only decodes Bold, Italic, Code or Underline. It doesn't decode Lists.
I really crave this feature, Because I want to store the text in Room and then also show it again when user reopens the note. but the problem is: when I store the text using richTextState.toMarkdown() it only decodes certain values and not lists or highlighted lists.
so when I reCompose the MarkDowned Text it does show text in bold or italic or underlined style. but it lacks the Lists and other very important styles.

Does this feature exist or it is coming or is it not neccessary?

this is my code:

  • following code is where I save the text :
    changeNoteCardText = { changeNoteCardText(cardId.value,2,notesRichTextState.toMarkdown()) notesRichTextState.setMarkdown(removeUnwantedSymbols( notesRichTextState.toMarkdown())) changeEdit(false) } )
    -and this is how I show the text:
    LaunchedEffect(true) { notesRichTextState.setMarkdown(removeUnwantedSymbols( notesText)) }
@MohamedRejeb
Copy link
Owner

MohamedRejeb commented Mar 30, 2024

Thanks for reporting this!
Currently not all the styles are supported in markdown but it's on top of my list.
You can use toHtml() instead and save the html string to Room, it supports all the styles.

@IsrarShamim
Copy link
Author

Thanks for reporting this! Currently not all the styles are supported in markdown but it's on top of my list. You can use toHtml() instead and save the html string to Room, it supports all the styles.

Yes, I actually learned that when I was checking out the code. But the problem is my code is already heavily dependent on MarkDown that I can't use html now.
I think I might have to do the transition regardless. it will be a pain but I will do it.
Please add this feature for others at least.
Thank you❤️❤️

@IsrarShamim
Copy link
Author

is there a function to convert markDown Text to Html string?

@MohamedRejeb
Copy link
Owner

Unfortunately no, all you can do is Convert Markdown -> RichTextState -> HTML

@MohamedRejeb
Copy link
Owner

Now lists should be working fine with markdown starting from v1.0.0-rc04

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

No branches or pull requests

2 participants