I am making a C++ wxWidgets application, where I need to deal with markdown in a…
Jump to turn (6)
- 1I am making a C++ wxWidgets application, where I need to deal with markdown in a
- 2Why would I need to parse to HTML.first instead of just parse the markdown itsel
- 3Can I just write the parser for the wxRichTextCtrl directly myself instead of ha
- 4How much complexity are we talking about?
- 5Between doing that, and using an intermediate parser to go HTML and then change
- 6I see, I think I will work with the wxRichTextCtrl, since I am making a chat app
- User
I am making a C++ wxWidgets application, where I need to deal with markdown in a wxRichTextCtrl, how would you deal with that?
- Assistant
To display markdown in a wxRichTextCtrl, you will need to convert the markdown text to formatted rich text that can be displayed in the control. Here are some steps you could follow to achieve this:
-
Parse the markdown text: Use a markdown parsing library such as markdown-cpp or cmark to convert the markdown text to HTML or another intermediate format.
-
Convert the parsed text to wxRichTextCtrl format: Use the parsed text to generate rich text formatting commands that can be applied to the wxRichTextCtrl. This may involve converting HTML tags to wxWidgets rich text commands.
-
Apply the formatting to the wxRichTextCtrl: Set the rich text content of the wxRichTextCtrl using the formatting commands generated in step 2.
-