Giter Site home page Giter Site logo

avalonia.htmlrenderer's People

Contributors

arthurhub avatar configurator avatar cyotek avatar fitdev avatar grokys avatar gyfke avatar helluvamatt avatar jakubmarecek avatar jeromerg avatar jfillbrook avatar jkoritzinsky avatar jmacato avatar jp2masa avatar kekekeks avatar licshee avatar maxkatz6 avatar mikkelxn avatar nikolaybobrovskiy avatar pawelmaj avatar redwyre avatar sbscomp avatar schdck avatar sergio73 avatar splitwirez avatar steck avatar swdriessen avatar tkefauver avatar vmlf01 avatar wieslawsoltes avatar wojciechkrysiak avatar

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avalonia.htmlrenderer's Issues

Avalonia.Browser demo broken?

Hi there,

The Html renderer looks great. Really impressed running the demo desktop app.

Unfortunately - I cannot get passed the below error with the Browser app. Tried multiple browsers running on Windows 10.

Uncaught SyntaxError SyntaxError: The requested module './avalonia.js' does not provide an export named 'registerAvaloniaModule'
at (program) (localhost꞉5001/main.js:2:10)

Thanks for any help!

Feature request - support border dotted style

It seems to support border-style:dashed, but not dotted.

I would be surprised if people still cared about all the other styles such as ridge and groove etc., but having both dashed and dotted would be nice.

image

Does not parse "border" fully + possible margin issue

Possibly two issues here. See screenshot below.

  1. Does not parse the tag string border:medium solid blue fully but ignores the color. However, it does parse border:medium solid;border-color:blue;.

  2. Correct me if I am mistaken on this, but there should be no spacing between the two borders shown in the screenshot and margin is explicitly set to 0 for both.

Linux Debian 12. Avalonia 11.

image

HtmlLabel and HtmlPanel are not available on v0.10

Hello. I can't seem to be able to use both HtmlLabel and HtmlPanel on v0.10. I have tested v11 and it worked fine.

When I declare a XAML namespace for the HtmlRenderer package, only HtmlContainer is shown.

Creating a fresh project, adding the 0.10 nuget package, adding the namespace and trying to find the controls result in the following:

image

devenv_aoXJZBqHuC.mp4

The code-behind also doesn't feature them:

image

And these are the contents of the namespace in v11, which is the expected:

image

Unexpected blank lines

First of all, I would like to thank you for this great library.

When rendering this simple HTML code

<html>
  <body>
    <p><b>Line 1</b><br><b>Line 2</b><br><b>Line 3</b><br><b>Line 4</b></p>
  </body>
</html>

the result looks like
current_result

Expected result:
expected_result

If I change the block

else if (box.Boxes[i].IsBlock)
{
  followingBlock = true;
}

in the CorrectLineBreaksBlocks method of DomParser.cs to

else if (box.Boxes[i].IsBlock && !box.Boxes[i].IsBrElement)
{
  followingBlock = true;
}

it works, at least for my use case.

The "AvaloniaStatsTask" task failed unexpectedly

I've cloned the repo & I'm trying to build HtmlRenderer.Demo.Avalonia.Desktop and I'm getting the following build error:

Error	MSB4018	The "AvaloniaStatsTask" task failed unexpectedly.
System.IO.IOException: The semaphore timeout period has expired.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at Avalonia.Telemetry.AvaloniaStatsTask.ConnectToPipe()
   at Avalonia.Telemetry.AvaloniaStatsTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	Avalonia.HtmlRenderer	C:\Users\deantric\.nuget\packages\avalonia.buildservices\0.0.12\buildTransitive\Avalonia.BuildServices.targets	9	

Any tips?

Chinese characters are garbled

image

This is one of my tests, the red box is Chinese, but the characters are garbled
This is bug or my fault?
How to fixed it?
Thinks for your time.

Render to Bitmap

Is it possible to render content to Avalonia Bitmap? Original project has a HtmlRender.RenderToImage that fulfills this purpose.

Another feature request - support alpha channel

Does not support alpha in colors.

This is fine: background-color:#756575;
But this is not: background-color:#756575ff; and no background is shown.

This is also fine: background-color:rgb(201, 76, 76)
But this is not: background-color:rgba(201, 76, 76, 0.3)

Consider adding it?

Discussion - center align images with HtmlRenderer

This is more of a discussion, but I was trying to centre an image with HtmlRenderer. However, it supports neither margin:auto or float.

This is merely an online note to anyone trying to do the same thing. Here's how I managed it.

image

image

HtmlPanel control

In HtmlControl.cs there is a large comment referencing HtmlLabel and HtmlPanel. There doesn't appear to be an HtmlPanel, in fact the only public class with a public constructor appears to be HtmlLabel. Is there any way to render chunk of HTML in a panel with Avalonia?

I'm looking for a cross platform equivalent to the System.Windows.(Controls|Forms).WebBrowser control - preferably one that doesn't require a Chrome process to be loaded up (which I believe is how CefGlue works, if I'm not mistaken). Avoiding the Chrome process was my primary reason for choosing Avalonia over Electron for my project.

Thanks! :)

PS - are there any implementation examples/demos or documentation for this that I can reference? thx again

PS Again - when I say "WebBrowser" equivalent I should clarify that it doesn't need to be used for anything complex. I'm essentially rendering Markdown to HTML using Markdig. So it will be some headers, bold, italic, links, etc. No crazy layout or anything.

custom font not work

I use the demo to set custom fonts, like this:

var f = new FontFamily(
            new Uri("avares://AvaloniaPreviewApp/Assets/Fonts/CustomFont.ttf"),
            "1 Smoothy DNA");

HtmlRender.AddFontFamily(f);

HtmlLabel and HtmlControl Unable to use custom font rendering, but the same code works fine in WPF

.css class "Display: flex;" dose not render when applyed

Css in the style div on the head does not respect the display flag flex, and renders nothing with the class applyed.

<style> .banner { width: 100%; height: auto; position: relative; justify-content: center; align-items: center; display: flex; } </style>

Comment - thank you!

[Discussion]
Overrall I think HtmlRenderer is pretty good and will be using it. Thank you for providing it!

Update used Avalonia version / update nuget package

Is it possible to update the used Avalonia version in this project? I was using the nuget package of this project (version 0.6.1), in conjunction with NetSparkle.
When trying to open an update window from the netsparkle library the following error is thrown:
image
When I download the source code of this project and remove the nuget package reference and change it to a project reference, everything is working fine.
For now I can workaround by using the source code of this repository, but a refreshed nuget package would come in handy.

Feature request - support tab-size

Does not support setting of tab-size.

This would be easy to add, yes?

(In the screenshot below, they all align vertically but they shouldn't.)

image

HtmlLabel.cs seems not to be correct ...

Hi, I am particularly referring to the following code within HtmlLabel.cs and there f.e. to the first else if. Something seems to be missing there. Since Avalonia at the moment seems not to be capable of displaying text with inlines in it, I hoped that I could somehow use your HtmlRenderer ;).

      /// <summary>
        /// Handle when dependency property value changes to update the underline HtmlContainer with the new value.
        /// </summary>
        private static Action<IAvaloniaObject, AvaloniaPropertyChangedEventArgs> OnAvaloniaProperty_valueChanged = new Action<IAvaloniaObject, AvaloniaPropertyChangedEventArgs>((AvaloniaObject, e) =>
        protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> e)
        {
            var control = AvaloniaObject as HtmlLabel;
            if (control != null)
            base.OnPropertyChanged(e);
            if (e.Property == AutoSizeProperty)
            {
                if (e.Property == AutoSizeProperty)
                if (e.NewValue.GetValueOrDefault<bool>())
                {
                    if ((bool)e.NewValue)
                    {
                        AvaloniaObject.SetValue(AutoSizeHeightOnlyProperty, false);
                        control.InvalidateMeasure();
                        control.InvalidateVisual();
                    }
                    SetValue(AutoSizeHeightOnlyProperty, false);
                }
                else if (e.Property == AutoSizeHeightOnlyProperty)
            }
            else if (e.Property == AutoSizeHeightOnlyProperty)
            {
                if (e.NewValue.GetValueOrDefault<bool>())
                {
                    if ((bool)e.NewValue)
                    {
                        AvaloniaObject.SetValue(AutoSizeProperty, false);
                        control.InvalidateMeasure();
                        control.InvalidateVisual();
                    }
                    SetValue(AutoSizeProperty, false);
                }
            }
        });

        }
        #endregion
    }

Doesn't work on nightly

When trying to use it on the nightly, I get the following error:

System.IO.FileNotFoundException: Could not load file or assembly 'Avalonia.Visuals, Version=0.10.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'. The system cannot find the file specified.

I assume that is because of this change:
https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes

Avalonia.Animation, Avalonia.Input, Avalonia.Interactivity, Avalonia.Layout, Avalonia.Visuals and Avalonia.Styling assemblies were merged into a Avalonia.Base assembly. While API surface wasn't changed, it's still a binary breaking change, and third-party packages needs to be recompiled to work with a new version.

So this package needs to be recompiled to work with it.

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.