Search code examples
c#parsingrichtextboxwikimarkup

Parse string with wiki markdown and show like in browser


Hopefully you can help me as I do not find a solution neither on the web nor in my brain. I am querying a issue-tracking-system (jira) via a webrequest. The systems answer is a json-file with a description of an issue represented by a string that has wiki-markdowns in it. It is possible to show this string 1:1 to the user. But I would prefer a solution to somehow parse the string and show the user not the textual markdown but the parsed elements like tables or numbered enumerations. I use C# and currently I am showing the information in a richtextbox, but I guess richtextbox is not the element you choose for such a requirement.

For Example the following string is returned by the jira-system and I would like it to be shown as a "real" table and an enumeration to the user.

||criteria||status||
|concept 1|open|
|concept 2|open|
* topic 1
* topic 2

Hope you can help me


Solution

  • after long researches the answer is totally simple. The Jira offers a conversion from markdown to html itself. When you query an issue via a URL just add ?expand=renderedFields to the URL like explained here https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-I-get-the-rendered-HTML-of-a-wiki-markup-field-in-JIRA/qaq-p/495779

    You will receive the answer like before and additional to that the html-writing of the answer. With that answer it is almost simple to show it in an webbrowser-element in the UI