You can also manually use the parser to convert a Markdown text into a TextAsset or a string in RichText format to display it with
TextMeshPro.
using MarkdownToUnity;
UnityUIMarkdownTextAsset asset = MarkdownUnityParser.ParseMarkdown(markdownText);MarkdownToUnit
The asset contains all the elements to be rendered. Example functions can be found in the MarkdownToUnityRenderer class.
For asynchronous calls, you can use coroutines or UniTask:
private IEnumerator Test(TextAsset markZip, string languageMarker) {
if(spinner != null) { spinner.SetActive(true); }
Task<UnityUIMarkdownTextAsset> parseTask = MarkdownUnityParser.ParseMarkdown(markZip,
languageMarker);
yield return new WaitUntil(() => parseTask.IsCompleted);
if (parseTask.IsFaulted) {
Debug.LogError($"Exception: {parseTask.Exception?.InnerException?.Message}");
} else {
UnityUIMarkdownTextAsset asset = parseTask.Result;
if (asset != null) {
Examples
Video (mp4)
MarkdownUnityRenderer.Render(asset, content, textPrefab.gameObject, horizontalLinePrefab,
blockquotePrefab);
// Or own Logic
}
}
if (spinner != null) { spinner.SetActive(false); }
}

