Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The code content is not rendered #117

Closed
239573049 opened this issue Jun 30, 2023 · 2 comments
Closed

The code content is not rendered #117

239573049 opened this issue Jun 30, 2023 · 2 comments

Comments

@239573049
Copy link

The code content is not rendered

image

The following is the content

以下是使用C#实现冒泡排序的示例代码:

public static void BubbleSort(int[] arr)
{
    int n = arr.Length;
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
        {
            if (arr[j] > arr[j + 1])
            {
                // 交换arr[j]和arr[j+1]
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
}

在这个示例中,我们使用了两个嵌套的for循环来遍历数组并比较相邻的元素。如果前一个元素大于后一个元素,则交换它们的位置。这样,每次循环都会将当前未排序的最大元素移动到数组的末尾。最终,数组将按升序排列。

Use version

  <ItemGroup>
    <PackageReference Include="Avalonia" Version="11.0.0-rc1.1" />
    <PackageReference Include="Avalonia.Desktop" Version="11.0.0-rc1.1" />
    <PackageReference Include="Avalonia.Markup.Xaml.Loader" Version="11.0.0-rc1.1" />
    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-rc1.1" />
    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0-rc1.1" />
    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-rc1.1" />
    <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-rc1.1" />
    <PackageReference Include="Markdown.Avalonia" Version="11.0.0-d1" />
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0-preview1" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
    <PackageReference Include="Semi.Avalonia" Version="11.0.0-rc1" />
  </ItemGroup>

@whistyun
Copy link
Owner

whistyun commented Jul 1, 2023

How did you setup styles in App.xaml?

Markdown.Avalonia uses AvaloniaEdit to render a code content.
AvaloniaEdit requires a dedicated style.

AvaloniaEdit requires the style; avares://AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml or avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml.
Markdown.Avalonia add automatically the style when Avalonia.Themes.Simple or Avalonia.Themes.Fluent is added to App.xaml.
For example, the following statement will cause that Markdown.Avalonia adds the style.

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Markdown.AvaloniaFluentAvaloniaDemo"
             xmlns:sty="using:FluentAvalonia.Styling"
             x:Class="Markdown.AvaloniaFluentAvaloniaDemo.App">
  <Application.Styles>
    <SimpleTheme />    <!-- Add SimpleTheme or FluentTheme at the top -->
    <sty:FluentAvaloniaTheme />
    <StyleInclude Source="/Assets/AppendingStyles.axaml"/>
  </Application.Styles>
</Application>

@239573049
Copy link
Author

Sorry, I found the problem, it was caused by the style affecting when referring to another library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants