Search Unity

Simple HTML/MarkDown renderer for TextMeshPro?

Discussion in 'UGUI & TextMesh Pro' started by JoeStrout, Mar 2, 2020.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm looking for something to render very simple HTML (paragraphs, images, links, maybe <pre> and tables) for use in in-game help and news. I'd prefer not to rely on native web view components, since I want it to look/work the same on all platforms, and I'd like it to use TextMeshPro so the text matches everything else in my app.

    I found this old asset, but it hasn't been updated in years and most of the links it references are dead. It appears to be based on this code, but from a quick perusal that code is based entirely on OnGUI rather than building UI assets.

    If necessary I'll build it myself... TextMeshPro already handles a lot of styling tags already, so it would be mostly a matter of computing layout of the paragraphs, images, and tables, and figuring out how to handle links. But it's hard to believe nobody has made something like that asset in recent times. Any pointers?

    EDIT: Thinking about it a bit more, I realize that a simpler markup format (such as some flavor of MarkDown) would work just as well. (Thread title updated accordingly.)
     
    Last edited: Mar 2, 2020
  2. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    I recently wrote a simple markdown renderer for my project. If you or someone else is interested in it let me know :)
     
  3. Donutask

    Donutask

    Joined:
    Apr 24, 2019
    Posts:
    7
    im interested
     
  4. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    Cool! I'm pretty busy right now, but sometime this week or next week I'll clean it up, make a demo and open source it. If I forget to do that please feel free to bug me about it haha
     
  5. Donutask

    Donutask

    Joined:
    Apr 24, 2019
    Posts:
    7
    Cool! I didn't expect you to reply to a 2 year old post.
     
  6. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    this post is 8 months old, unless you are from the future?
     
  7. Donutask

    Donutask

    Joined:
    Apr 24, 2019
    Posts:
    7
    The forum has a 2 dates on each post. I read the join date. lol
     
  8. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    It does work in both editor and runtime! Thanks for the reminder, I'll release it over the winter break and post here when I do :D
     
    joseph114591452 likes this.
  9. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    I am also interested. I was googling to see what is out there this morning with plans of writing one if I couldn't find one and found your post!

    How fortuitous...
     
    cxode likes this.
  10. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
  11. up201806339

    up201806339

    Joined:
    Jun 4, 2020
    Posts:
    1
    What a lifesaver!
    Also, do you know why I can't access the MarkdownRenderer component inside a script? I've installed the dependencies you mentioned, and just dragged the FancyTextRendering folder into the project.

    upload_2021-3-1_18-1-37.png
     
    cxode likes this.
  12. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    Thanks @up201806339 , I'm glad you find it useful! All the FancyTextRendering scripts are contained in an assembly definition, so to use them you will need to make sure your code has a reference to that assembly.

    In the future if you have issues, I'd appreciate it if you'd open them as issues on the Github repo. Keeping all of them in one place makes it easier for others to search for a solution to their problem.