Giter Site home page Giter Site logo

unitymarkdownviewer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

unitymarkdownviewer's Issues

Unnecessary debug logs in package

StyleConverter:37-39

        public StyleConverter( GUISkin skin )
        {
            mReference  = new GUIStyle[ CustomStyles.Length ];
            mWorking    = new GUIStyle[ CustomStyles.Length ];

            for( var i = 0; i < CustomStyles.Length; i++ )
            {
                Debug.Log( mReference[ i ] );
                Debug.Log( skin );
                Debug.Log( CustomStyles[ i ] );

                mReference[ i ] = skin.GetStyle( CustomStyles[ i ] );
                mWorking[ i ]   = new GUIStyle( mReference[ i ] );
            }
        }

image

Bug: no way to set base URL for images etc.

When using UnityMarkdownViewer programmatically (e.g. downloading a .md file as text and then displaying it), images currently can't be properly resolved when the image URLs are relative to the markdown document location.

Would be great if there was a way to specify a base URL where relative URLs are then referred to (for example: a callback to decide for each URL what to do with it).

Example: download https://raw.githubusercontent.com/atteneder/glTFast/main/README.md via UnityWebRequest and display it by passing the text to a new MarkdownViewer.
Expected: can attach a callback for URls or specify the base URL in another way so that relative image URLs work
Actual: getting errors since the relative URLs can't be resolved properly

Right place for such a callback would probably be MarkdownHandleImages.RemapURL?

(BUG) Sometimes does not render document contents when selecting another text asset

Thanks for creating this asset!
It's a lot more sexy than the default text document renderer that ships with Unity ❤

It seems that after rendering a markdown document, if you select a new markdown document (no matter what other markdown document it is), the document rendering fails. So if you are tapping the arrow keys to browse through your markdown files, you'd experience alternating "working/not working" document rendering as you browse through the files. I've added steps to reproduce below :)

Steps to reproduce:

  1. Click markdown file. Observe: Renders as expected.
    image

  2. Press up arrow or click the markdown file above it in the Project window. Observe: Does not render document contents.
    image

  3. Press up arrow or click the markdown file above it in the Project window. Observe: Renders as expected.
    image

  4. Press up arrow or click the markdown file above it in the Project window. Observe: Does not render document contents.
    image

Unity Asset Store missing

Hi, thanks for the awesome tool! I think this tool was available on Unity Asset Store but I could not find it anymore? Am I missing anything? 😕

How to change font?

In a md file like this

### English 繁體中文

English 繁體中文

**English 繁體中文**

This is a sentence.

這是一個句子

And it is how it look like in unity inspector

image

I think its bcuz the font dont support other language ?

so i want to change font that support more language for consistent looking in different language.

thanks for making this great plugin!!

Dark Skin

Would be really nice to have a dark skin!

MkViewer as component

Hi!
Is there a chance to have the MdViewer like a component to use it in a EditorWindow?
I have the .md string and it would be cool to have something like

MarkdownViewer.For(myMdAsString).Render();

Usage within a IMGUI Container

Hello, big fan of this package!

I am trying to use your renderer inside a UIElements IMGUI Container, but it results in all text being rendered on the same line:

image

Any chance you could add support for this? :)

Also, it would be super great if you could publish this repo as a NPM package to github.

Doing so is really easy using Github Actions: https://github.com/marketplace/actions/npm-publish
You would need to add some lines to the package.json file:

"repository": {
    "type": "git",
    "url": "https://github.com/gwaredd/UnityMarkdownViewer.git"
},
"publishConfig": {
    "registry": "https://npm.pkg.github.com/@gwaredd"
}

By publishing it as a GitHub package, it becomes possible for other Unity packages to be set up to depend on this package, which would be very useful for us.

Bold text looks bad

image

This is in Unity 2021.3.x.

The bolded text is implemented using Unity's boldening of a font referenced via GUIStyle but it seems it doesn't work so well with the included SourceSansPro-Light font.

I think a way to fix this would be to use the SourceSansPro-SemiBold or SourceSansPro-Bold to implement bolded text instead of relying on Unity's boldening of an existing font. Probably this means doing the same for italic and italic+bolded.

This would probably require changes to the StyleConverter class, which currently looks like this:

public GUIStyle Apply( Style src )
{
    if( src.Block )
    {
        return mWorking[ FixedBlock ];
    }

    var style = mWorking[ src.Size ];

    if( mCurrentStyle != src )
    {
      
        var reference = mReference[ src.Fixed ? FixedInline : Variable ];

        style.font             = reference.font; // Set different fonts based on normal/bold/italic/bold+italic
        style.fontStyle        = src.GetFontStyle(); // Always 'normal' instead of normal/bold/italic/bold+italic
        style.normal.textColor = src.Link ? linkColor : reference.normal.textColor;

        mCurrentStyle = src;
    }

    return style;
}

Markdig version

I've been working on a UIToolkit implementation of Markdig, and I noticed that the Markdig distribution of the dll doesn't work in Unity.

Did you use a custom version of markdig to make it work in unity?

Render markdown in custom editor window script?

Is it possible to render a markdown file using this package in a custom script? I'm hoping I can hook this up to my custom editor window so I can avoid writing a translation layer so my markdown files will render properly according to the markdown syntax/style.

Animated GIF support

This is a great complement to my https://github.com/TheWizardsCode/DevLogger - a tool for keeping a DevLog from within Unity.

One of the features I need (and will add if/when I figure out how - no promises) is support for Animated GIFs. I post the idea hear in case anyone else is interested and wants to be notified if I ever do it and the code gets merged and more importantly, ask if anyone has any ideas how to get it done.

Markdown Viewer doesn't render any spaces in Unity 2023.1 or later

Thetextalllookslikethis.

It looks like this is due to GUIStyle.CalcSize() not counting the trailing space. LayoutBuilder.AddWord() calls CalcSize() on a string with a trailing space for each word. But I'm not sure why this used to work. Did the CalcSize() implementation change?

Duplicating view

Hello, I just found your asset and it seems pretty amazing.

But I'm having one problem:
image
The inspector view just duplicates.
I installed through the package manager (don't know if this makes any huge difference)

Thank you

Not working with UPM

Hey there, not much of a problem more like an inconvinience.

Using Unity 2022.2.5.f1. Tried installing via upm from git link. Everything seemed ok in UPM but getting this error whenever I click on .md file. Nothing happens in the preview window (normal text preview):

NullReferenceException: Object reference not set to an instance of an object
MG.MDV.StyleConverter..ctor (UnityEngine.GUISkin skin) (at ./Library/PackageCache/com.mischief.markdownviewer@cc8c569e13/Editor/Scripts/Layout/StyleConverter.cs:44)
MG.MDV.Context..ctor (UnityEngine.GUISkin skin, MG.MDV.HandlerImages images, MG.MDV.HandlerNavigate navigate) (at ./Library/PackageCache/com.mischief.markdownviewer@cc8c569e13/Editor/Scripts/Layout/Context.cs:9)
MG.MDV.MarkdownViewer.ParseDocument () (at ./Library/PackageCache/com.mischief.markdownviewer@cc8c569e13/Editor/Scripts/MarkdownViewer.cs:67)
MG.MDV.MarkdownViewer..ctor (UnityEngine.GUISkin skin, System.String path, System.String content) (at ./Library/PackageCache/com.mischief.markdownviewer@cc8c569e13/Editor/Scripts/MarkdownViewer.cs:34)
MG.MDV.MarkdownEditor.OnEnable () (at ./Library/PackageCache/com.mischief.markdownviewer@cc8c569e13/Editor/Scripts/MarkdownEditor.cs:28)

When I clone straight into packages directory with git few erros popup on first start up but on recompile everything works. Unfortunately the problem with UPM persists no matter how many times I recompile.

It would be nice to just use this as UPM dependency and not bother with 2 installs. But if you consider this small issue, just close this. Thanks and keep up the great work. Love it.

UnityWebRequest.isHttpError' is obsolete:

I noticed these messages when upgrading to 2020

Assets/UnityMarkdownViewer/Editor/Scripts/MarkdownHandleImages.cs(159,17): warning CS0618: 'UnityWebRequest.isHttpError' is obsolete: 'UnityWebRequest.isHttpError is deprecated. Use (UnityWebRequest.result == UnityWebRequest.Result.ProtocolError) instead.'

I also get this, but I don't know if it's related to UMV:

Failed to destroy editor windows: #1
FallbackEditorWindow
UnityEditor.WindowLayout:LoadDefaultWindowPreferences () (at /home/bokken/buildslave/unity/build/Editor/Mono/GUI/WindowLayout.cs:72)

Not rendering on 2019.2

For some reason I couldn't make it work on 2019.2 - nothing gets rendered (default import). Plus some errors pop (about file location) if I try to move the the folder to a subdirectory.

Ideas?

This package is magic and I love it

I don't have anything to request or report, I just wanted to thank you for making this. It very quickly made my day easier and is proving very useful in organizing my thoughts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.