I am making a C++ wxWidgets application, were i have a wxrchtextbox where i apply a…
Private research annotation
Sign in to add a private research label or note.
- User
I am making a C++ wxWidgets application, were i have a wxrchtextbox where i apply a markdown format over it, using styles provide by the richtextbox, everything done manually when parsing the text to be written. I have everything working correctly except for a little problem. if the user writes the markdown directly it works correctly, but when they input it through the markdown codeblock, which means three backsticks and specifying "markdown" as a language, it ends up messing the format, since i didn't remove this or skip its marker entirely, which is the correct solution. so what I want is this.
- correct functionality, how it currently works:
input string: "A text with markdown format italic and bold."
Parser goes like this:
- Text without format is simple written"A text with markdown format "
- Found an italic, mark it with a begin marker and end marker, then apply the format inside that marker and write the text.
- Found a bold, mark it with a begin marker and end marker, then apply the format inside that marker and write the text.
then write the rest of the string.
Now the codeblock with three backsticks, it marks as code block, but should be skipped or removed so this:
input string: "```markdown A text with markdown format italic and bold.
"should be deal as it were like this: "A text with markdown format *italic* and **bold**." Which means, getting the substring from inside and assign to the original starting and ending markers of the code block. Did you understand? Let me know so I can paste my code and work from there? - Assistant
- User
- Assistant
- User
what did you do? Write the markdown characters escaping them, siince my browser parse your answer and get everything mingled up
- Assistant
- User
No it didn't escaped correctly, use a name for it like THREE_BACKSTICKS and I will change it on my own.
- Assistant
- User
I manage to fix it, now I have problem with the url part, Currently it works perfectly if the url has the correct markdown format or an invalid format like not having an url in the parenthesis, but if there is no parenthesis it write all the text. I want to find the parenthesis after the first character like this text this is valid, but [text] (url) shouldn't be allowed. Currently I use this code:
wxString::size_type endLinkText = formattedMessage.find(END_LINK_TEXT_MARKER, markerPos); wxString::size_type startLinkUrl = formattedMessage.find(START_LINK_URL_MARKER, endLinkText); wxString::size_type endLinkUrl = formattedMessage.find(END_LINK_URL_MARKER, startLinkUrl);
- Assistant